All pastes #1017439 Raw Edit

Stuff

public diff v1 · immutable
#1017439 ·published 2008-05-13 23:37 UTC
rendered paste body
Index: include/asterisk/lock.h===================================================================--- include/asterisk/lock.h	(revision 116087)+++ include/asterisk/lock.h	(working copy)@@ -1196,18 +1196,21 @@  struct ast_channel; +#define ast_channel_lock(a) __ast_channel_lock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_lock(struct ast_channel *chan);+int __ast_channel_lock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_unlock(a) __ast_channel_unlock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Unlock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_unlock(struct ast_channel *chan);+int __ast_channel_unlock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_trylock(a) __ast_channel_trylock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note   You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_trylock(struct ast_channel *chan);+int __ast_channel_trylock(struct ast_channel *chan, const char *file, int lineno, const char *func); #endif  #endif /* _ASTERISK_LOCK_H */Index: main/channel.c===================================================================--- main/channel.c	(revision 116087)+++ main/channel.c	(working copy)@@ -4534,7 +4534,7 @@ /*! \brief Unlock AST channel (and print debugging output)  \note You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_unlock(struct ast_channel *chan)+int __ast_channel_unlock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { 	int res = 0; 	if (option_debug > 2) @@ -4545,8 +4545,11 @@ 			ast_log(LOG_DEBUG, "::::==== Unlocking non-existing channel \n"); 		return 0; 	}-+#ifdef DEBUG_THREADS+	res = __ast_pthread_mutex_unlock(filename, lineno, func, "chan->lock", &chan->lock);+#else 	res = ast_mutex_unlock(&chan->lock);+#endif  	if (option_debug > 2) { #ifdef DEBUG_THREADS@@ -4573,14 +4576,18 @@  /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_lock(struct ast_channel *chan)+int __ast_channel_lock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { 	int res;  	if (option_debug > 3) 		ast_log(LOG_DEBUG, "====:::: Locking AST channel %s\n", chan->name); +#ifdef DEBUG_THREADS+	res = __ast_pthread_mutex_lock(filename, lineno, func, "chan->lock", &chan->lock);+#else 	res = ast_mutex_lock(&chan->lock);+#endif  	if (option_debug > 3) { #ifdef DEBUG_THREADS@@ -4605,14 +4612,17 @@  /*! \brief Lock AST channel (and print debugging output) \note	You need to enable DEBUG_CHANNEL_LOCKS for this function */-int ast_channel_trylock(struct ast_channel *chan)+int __ast_channel_trylock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { 	int res;  	if (option_debug > 2) 		ast_log(LOG_DEBUG, "====:::: Trying to lock AST channel %s\n", chan->name);-+#ifdef DEBUG_THREADS+	res = __ast_pthread_mutex_trylock(filename, lineno, func, "chan->lock", &chan->lock);+#else 	res = ast_mutex_trylock(&chan->lock);+#endif  	if (option_debug > 2) { #ifdef DEBUG_THREADS