[asterisk-dev] [svn-commits] tilghman: trunk r125020 - in /trunk: channels/ include/asterisk/

Russell Bryant russell at digium.com
Fri Jun 27 09:02:20 CDT 2008


On Jun 24, 2008, at 10:34 PM, SVN commits to the Digium repositories  
wrote:

> Author: tilghman
> Date: Tue Jun 24 21:34:11 2008
> New Revision: 125020
>
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=125020
> Log:
> More expansion of the deadlock avoidance macro, including a macro to  
> do locking
> of the channel lock
>
> Modified:
>    trunk/channels/chan_dahdi.c
>    trunk/channels/chan_features.c
>    trunk/channels/chan_h323.c
>    trunk/channels/chan_iax2.c
>    trunk/channels/chan_local.c
>    trunk/include/asterisk/lock.h
>

<snip>

> Modified: trunk/include/asterisk/lock.h
> URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=125020&r1=125019&r2=125020
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- trunk/include/asterisk/lock.h (original)
> +++ trunk/include/asterisk/lock.h Tue Jun 24 21:34:11 2008
> @@ -289,6 +289,21 @@
> 		} \
> 	} while (0)
>
> +#define DLA_UNLOCK(lock) \
> +	do { \
> +		const char *__filename, *__func, *__mutex_name; \
> +		int __lineno; \
> +		int __res = ast_find_lock_info(lock, &__filename, &__lineno,  
> &__func, &__mutex_name); \
> +		ast_mutex_unlock(lock);
> +
> +#define DLA_LOCK(lock) \
> +		if (__res < 0) { /* Shouldn't ever happen, but just in case... */ \
> +			ast_mutex_lock(lock); \
> +		} else { \
> +			__ast_pthread_mutex_lock(__filename, __lineno, __func,  
> __mutex_name, lock); \
> +		} \
> +	} while (0)
> +
> static inline void ast_reentrancy_lock(struct ast_lock_track *lt)
> {
> 	pthread_mutex_lock(&lt->reentr_mutex);
> @@ -1428,6 +1443,10 @@
> 	ast_mutex_lock(lock); \
> 	usleep(1); \
> 	ast_mutex_unlock(lock);
> +
> +#define DLA_UNLOCK(lock)	ast_mutex_unlock(lock)
> +
> +#define DLA_LOCK(lock)	ast_mutex_lock(lock)
>
> typedef pthread_mutex_t ast_mutex_t;


Please add documentation for all of these lock juggling macros.

--
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.







More information about the asterisk-dev mailing list