mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 08:40:16 +00:00
Merge "lock: Replace __ast_mutex_logger with private log_mutex_error." into 13
This commit is contained in:
@@ -241,8 +241,6 @@ int __ast_rwlock_trywrlock(const char *filename, int lineno, const char *func, a
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
|
|
||||||
#define __ast_mutex_logger(...) do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0)
|
|
||||||
|
|
||||||
#ifdef THREAD_CRASH
|
#ifdef THREAD_CRASH
|
||||||
#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
|
#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
|
||||||
#else
|
#else
|
||||||
|
|||||||
93
main/lock.c
93
main/lock.c
@@ -46,6 +46,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#undef pthread_cond_wait
|
#undef pthread_cond_wait
|
||||||
#undef pthread_cond_timedwait
|
#undef pthread_cond_timedwait
|
||||||
|
|
||||||
|
#if defined(DEBUG_THREADS)
|
||||||
|
#define log_mutex_error(canlog, ...) \
|
||||||
|
do { \
|
||||||
|
if (canlog) { \
|
||||||
|
ast_log(LOG_ERROR, __VA_ARGS__); \
|
||||||
|
} else { \
|
||||||
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_THREADS) && defined(HAVE_BKTR)
|
#if defined(DEBUG_THREADS) && defined(HAVE_BKTR)
|
||||||
static void __dump_backtrace(struct ast_bt *bt, int canlog)
|
static void __dump_backtrace(struct ast_bt *bt, int canlog)
|
||||||
{
|
{
|
||||||
@@ -55,7 +66,7 @@ static void __dump_backtrace(struct ast_bt *bt, int canlog)
|
|||||||
strings = backtrace_symbols(bt->addresses, bt->num_frames);
|
strings = backtrace_symbols(bt->addresses, bt->num_frames);
|
||||||
|
|
||||||
for (i = 0; i < bt->num_frames; i++) {
|
for (i = 0; i < bt->num_frames; i++) {
|
||||||
__ast_mutex_logger("%s\n", strings[i]);
|
log_mutex_error(canlog, "%s\n", strings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_std_free(strings);
|
ast_std_free(strings);
|
||||||
@@ -134,7 +145,7 @@ int __ast_pthread_mutex_init(int tracking, const char *filename, int lineno, con
|
|||||||
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
int canlog = tracking && strcmp(filename, "logger.c");
|
int canlog = tracking && strcmp(filename, "logger.c");
|
||||||
|
|
||||||
__ast_mutex_logger("%s line %d (%s): NOTICE: mutex '%s' is already initialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): NOTICE: mutex '%s' is already initialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
@@ -171,7 +182,7 @@ int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *fu
|
|||||||
* linked with libpthread.
|
* linked with libpthread.
|
||||||
* This is not an error condition if the mutex is created on the fly.
|
* This is not an error condition if the mutex is created on the fly.
|
||||||
*/
|
*/
|
||||||
__ast_mutex_logger("%s line %d (%s): NOTICE: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): NOTICE: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
res = EINVAL;
|
res = EINVAL;
|
||||||
@@ -185,15 +196,15 @@ int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *fu
|
|||||||
pthread_mutex_unlock(&t->mutex);
|
pthread_mutex_unlock(&t->mutex);
|
||||||
break;
|
break;
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
break;
|
break;
|
||||||
case EBUSY:
|
case EBUSY:
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
||||||
@@ -208,7 +219,7 @@ int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *fu
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error destroying mutex %s: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error destroying mutex %s: %s\n",
|
||||||
filename, lineno, func, mutex_name, strerror(res));
|
filename, lineno, func, mutex_name, strerror(res));
|
||||||
}
|
}
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
@@ -282,14 +293,14 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
|
|||||||
if (res == EBUSY) {
|
if (res == EBUSY) {
|
||||||
wait_time = time(NULL) - seconds;
|
wait_time = time(NULL) - seconds;
|
||||||
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
||||||
filename, lineno, func, (int) wait_time, mutex_name);
|
filename, lineno, func, (int) wait_time, mutex_name);
|
||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
||||||
#endif
|
#endif
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET],
|
lt->file[ROFFSET], lt->lineno[ROFFSET],
|
||||||
lt->func[ROFFSET], mutex_name);
|
lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
@@ -323,7 +334,7 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
|
|||||||
lt->thread_id[lt->reentrancy] = pthread_self();
|
lt->thread_id[lt->reentrancy] = pthread_self();
|
||||||
lt->reentrancy++;
|
lt->reentrancy++;
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
ast_reentrancy_unlock(lt);
|
ast_reentrancy_unlock(lt);
|
||||||
@@ -343,7 +354,7 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining mutex: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining mutex: %s\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -399,7 +410,7 @@ int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *fu
|
|||||||
lt->thread_id[lt->reentrancy] = pthread_self();
|
lt->thread_id[lt->reentrancy] = pthread_self();
|
||||||
lt->reentrancy++;
|
lt->reentrancy++;
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
ast_reentrancy_unlock(lt);
|
ast_reentrancy_unlock(lt);
|
||||||
@@ -426,7 +437,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -437,9 +448,9 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
|
|||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
||||||
@@ -448,7 +459,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (--lt->reentrancy < 0) {
|
if (--lt->reentrancy < 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
|
log_mutex_error(canlog, "%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
lt->reentrancy = 0;
|
lt->reentrancy = 0;
|
||||||
}
|
}
|
||||||
@@ -479,7 +490,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error releasing mutex: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error releasing mutex: %s\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -549,7 +560,7 @@ int __ast_cond_wait(const char *filename, int lineno, const char *func,
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -560,16 +571,16 @@ int __ast_cond_wait(const char *filename, int lineno, const char *func,
|
|||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
||||||
#endif
|
#endif
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
} else if (lt->reentrancy <= 0) {
|
} else if (lt->reentrancy <= 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -589,7 +600,7 @@ int __ast_cond_wait(const char *filename, int lineno, const char *func,
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error waiting on condition mutex '%s'\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error waiting on condition mutex '%s'\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
} else if (lt) {
|
} else if (lt) {
|
||||||
@@ -614,7 +625,7 @@ int __ast_cond_timedwait(const char *filename, int lineno, const char *func,
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -625,16 +636,16 @@ int __ast_cond_timedwait(const char *filename, int lineno, const char *func,
|
|||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
||||||
#endif
|
#endif
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
} else if (lt->reentrancy <= 0) {
|
} else if (lt->reentrancy <= 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -654,7 +665,7 @@ int __ast_cond_timedwait(const char *filename, int lineno, const char *func,
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res && (res != ETIMEDOUT)) {
|
if (res && (res != ETIMEDOUT)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error waiting on condition mutex '%s'\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error waiting on condition mutex '%s'\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
} else if (lt) {
|
} else if (lt) {
|
||||||
@@ -676,7 +687,7 @@ int __ast_rwlock_init(int tracking, const char *filename, int lineno, const char
|
|||||||
if (t->lock != ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
if (t->lock != ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
||||||
int canlog = tracking && strcmp(filename, "logger.c");
|
int canlog = tracking && strcmp(filename, "logger.c");
|
||||||
|
|
||||||
__ast_mutex_logger("%s line %d (%s): Warning: rwlock '%s' is already initialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is already initialized.\n",
|
||||||
filename, lineno, func, rwlock_name);
|
filename, lineno, func, rwlock_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
@@ -708,7 +719,7 @@ int __ast_rwlock_destroy(const char *filename, int lineno, const char *func, con
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
if (t->lock == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
if (t->lock == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, rwlock_name);
|
filename, lineno, func, rwlock_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
res = EINVAL;
|
res = EINVAL;
|
||||||
@@ -721,7 +732,7 @@ int __ast_rwlock_destroy(const char *filename, int lineno, const char *func, con
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error destroying rwlock %s: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error destroying rwlock %s: %s\n",
|
||||||
filename, lineno, func, rwlock_name, strerror(res));
|
filename, lineno, func, rwlock_name, strerror(res));
|
||||||
}
|
}
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
@@ -759,7 +770,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||||
if ((t->lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
if ((t->lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
|
||||||
filename, line, func, name);
|
filename, line, func, name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -794,7 +805,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lock_found && --lt->reentrancy < 0) {
|
if (lock_found && --lt->reentrancy < 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): rwlock '%s' freed more times than we've locked!\n",
|
log_mutex_error(canlog, "%s line %d (%s): rwlock '%s' freed more times than we've locked!\n",
|
||||||
filename, line, func, name);
|
filename, line, func, name);
|
||||||
lt->reentrancy = 0;
|
lt->reentrancy = 0;
|
||||||
}
|
}
|
||||||
@@ -813,7 +824,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error releasing rwlock: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error releasing rwlock: %s\n",
|
||||||
filename, line, func, strerror(res));
|
filename, line, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -865,14 +876,14 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
if (res == EBUSY) {
|
if (res == EBUSY) {
|
||||||
wait_time = time(NULL) - seconds;
|
wait_time = time(NULL) - seconds;
|
||||||
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for readlock '%s'?\n",
|
log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for readlock '%s'?\n",
|
||||||
filename, line, func, (int)wait_time, name);
|
filename, line, func, (int)wait_time, name);
|
||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
||||||
#endif
|
#endif
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
|
lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
|
||||||
lt->func[lt->reentrancy-1], name);
|
lt->func[lt->reentrancy-1], name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
@@ -918,7 +929,7 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
|
||||||
filename, line, func, strerror(res));
|
filename, line, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -970,14 +981,14 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
if (res == EBUSY) {
|
if (res == EBUSY) {
|
||||||
wait_time = time(NULL) - seconds;
|
wait_time = time(NULL) - seconds;
|
||||||
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for writelock '%s'?\n",
|
log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for writelock '%s'?\n",
|
||||||
filename, line, func, (int)wait_time, name);
|
filename, line, func, (int)wait_time, name);
|
||||||
if (lt) {
|
if (lt) {
|
||||||
ast_reentrancy_lock(lt);
|
ast_reentrancy_lock(lt);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
||||||
#endif
|
#endif
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
|
lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
|
||||||
lt->func[lt->reentrancy-1], name);
|
lt->func[lt->reentrancy-1], name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
@@ -1022,7 +1033,7 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining write lock: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining write lock: %s\n",
|
||||||
filename, line, func, strerror(res));
|
filename, line, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -1111,7 +1122,7 @@ int __ast_rwlock_timedrdlock(const char *filename, int line, const char *func, a
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
|
||||||
filename, line, func, strerror(res));
|
filename, line, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -1200,7 +1211,7 @@ int __ast_rwlock_timedwrlock(const char *filename, int line, const char *func, a
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
|
||||||
filename, line, func, strerror(res));
|
filename, line, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ int mtx_prof = -1;
|
|||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
|
|
||||||
#define __ast_mutex_logger(...) do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0)
|
#define log_mutex_error(canlog, ...) do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0)
|
||||||
|
|
||||||
#ifdef THREAD_CRASH
|
#ifdef THREAD_CRASH
|
||||||
#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
|
#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
|
||||||
@@ -241,9 +241,9 @@ static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno
|
|||||||
|
|
||||||
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
if ((t->mutex) != (empty_mutex)) {
|
if ((t->mutex) != (empty_mutex)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is already initialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
|
||||||
t->file[0], t->lineno[0], t->func[0], mutex_name);
|
t->file[0], t->lineno[0], t->func[0], mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -280,7 +280,7 @@ static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno,
|
|||||||
|
|
||||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -291,19 +291,19 @@ static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno,
|
|||||||
pthread_mutex_unlock(&t->mutex);
|
pthread_mutex_unlock(&t->mutex);
|
||||||
break;
|
break;
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
break;
|
break;
|
||||||
case EBUSY:
|
case EBUSY:
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: '%s' was locked here.\n",
|
||||||
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = pthread_mutex_destroy(&t->mutex)))
|
if ((res = pthread_mutex_destroy(&t->mutex)))
|
||||||
__ast_mutex_logger("%s line %d (%s): Error destroying mutex: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error destroying mutex: %s\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||||
else
|
else
|
||||||
@@ -324,7 +324,7 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
ast_mutex_init(t);
|
ast_mutex_init(t);
|
||||||
}
|
}
|
||||||
@@ -345,9 +345,9 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
|
|||||||
if (res == EBUSY) {
|
if (res == EBUSY) {
|
||||||
current = time(NULL);
|
current = time(NULL);
|
||||||
if ((current - seconds) && (!((current - seconds) % 5))) {
|
if ((current - seconds) && (!((current - seconds) % 5))) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
||||||
filename, lineno, func, (int)(current - seconds), mutex_name);
|
filename, lineno, func, (int)(current - seconds), mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1],
|
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1],
|
||||||
t->func[t->reentrancy-1], mutex_name);
|
t->func[t->reentrancy-1], mutex_name);
|
||||||
}
|
}
|
||||||
@@ -373,11 +373,11 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
|
|||||||
t->thread[t->reentrancy] = pthread_self();
|
t->thread[t->reentrancy] = pthread_self();
|
||||||
t->reentrancy++;
|
t->reentrancy++;
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error obtaining mutex: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error obtaining mutex: %s\n",
|
||||||
filename, lineno, func, strerror(errno));
|
filename, lineno, func, strerror(errno));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno,
|
|||||||
|
|
||||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
ast_mutex_init(t);
|
ast_mutex_init(t);
|
||||||
}
|
}
|
||||||
@@ -407,11 +407,11 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno,
|
|||||||
t->thread[t->reentrancy] = pthread_self();
|
t->thread[t->reentrancy] = pthread_self();
|
||||||
t->reentrancy++;
|
t->reentrancy++;
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ast_mutex_logger("%s line %d (%s): Warning: '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Warning: '%s' was locked here.\n",
|
||||||
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,21 +426,21 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
|
|||||||
|
|
||||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
|
if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
|
||||||
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
|
log_mutex_error(canlog, "%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
|
||||||
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--t->reentrancy < 0) {
|
if (--t->reentrancy < 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
|
log_mutex_error(canlog, "%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
|
||||||
filename, lineno, func, mutex_name);
|
filename, lineno, func, mutex_name);
|
||||||
t->reentrancy = 0;
|
t->reentrancy = 0;
|
||||||
}
|
}
|
||||||
@@ -453,7 +453,7 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((res = pthread_mutex_unlock(&t->mutex))) {
|
if ((res = pthread_mutex_unlock(&t->mutex))) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error releasing mutex: %s\n",
|
log_mutex_error(canlog, "%s line %d (%s): Error releasing mutex: %s\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user