diff options
author | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-23 18:05:13 +0000 |
---|---|---|
committer | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-23 18:05:13 +0000 |
commit | e005dbccdff80ceb02ce7cc8576852c80e520e56 (patch) | |
tree | 1e2b07a7aa75eadc062fcad4be36f3355b0610d4 /include/asterisk/lock.h | |
parent | cc6e91422e06fcf597f039d73159505355474ac7 (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@29762 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/lock.h')
-rw-r--r-- | include/asterisk/lock.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 38c4e64ac..cf9549751 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -97,6 +97,13 @@ typedef struct ast_mutex_info ast_mutex_t; typedef pthread_cond_t ast_cond_t; +static pthread_mutex_t empty_mutex; + +static void __attribute__((constructor)) init_empty_mutex(void) +{ + memset(&empty_mutex, 0, sizeof(empty_mutex)); +} + static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t, pthread_mutexattr_t *attr) @@ -105,14 +112,16 @@ static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno int canlog = strcmp(filename, "logger.c"); if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) { - __ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n", - filename, lineno, func, mutex_name); - __ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n", - t->file, t->lineno, t->func, mutex_name); + if ((t->mutex) != (empty_mutex)) { + __ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n", + filename, lineno, func, mutex_name); + __ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n", + t->file, t->lineno, t->func, mutex_name); #ifdef THREAD_CRASH - DO_THREAD_CRASH; + DO_THREAD_CRASH; #endif - return 0; + return 0; + } } #endif |