32 #include "asterisk/utils.h"
36 #undef pthread_mutex_init
37 #undef pthread_mutex_destroy
38 #undef pthread_mutex_lock
39 #undef pthread_mutex_trylock
40 #undef pthread_mutex_t
41 #undef pthread_mutex_unlock
42 #undef pthread_cond_init
43 #undef pthread_cond_signal
44 #undef pthread_cond_broadcast
45 #undef pthread_cond_destroy
46 #undef pthread_cond_wait
47 #undef pthread_cond_timedwait
49 #if defined(DEBUG_THREADS) && defined(HAVE_BKTR)
50 static void __dump_backtrace(
struct ast_bt *bt,
int canlog)
58 __ast_mutex_logger(
"%s\n", strings[i]);
69 pthread_mutexattr_t attr;
73 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
87 ast_reentrancy_init(&t->
track);
91 pthread_mutexattr_init(&attr);
95 pthread_mutexattr_destroy(&attr);
106 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
108 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
116 __ast_mutex_logger(
"%s line %d (%s): NOTICE: mutex '%s' is uninitialized.\n",
117 filename, lineno, func, mutex_name);
123 ast_reentrancy_init(&t->
track);
133 __ast_mutex_logger(
"%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
134 filename, lineno, func, mutex_name);
137 __ast_mutex_logger(
"%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
138 filename, lineno, func, mutex_name);
140 ast_reentrancy_lock(lt);
141 __ast_mutex_logger(
"%s line %d (%s): Error: '%s' was locked here.\n",
146 ast_reentrancy_unlock(lt);
156 __ast_mutex_logger(
"%s line %d (%s): Error destroying mutex %s: %s\n",
157 filename, lineno, func, mutex_name, strerror(res));
160 ast_reentrancy_lock(lt);
161 lt->
file[0] = filename;
169 ast_reentrancy_unlock(lt);
170 delete_reentrancy_cs(&t->
track);
184 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
189 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
197 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized and unable to initialize.\n",
198 filename, lineno, func, mutex_name);
205 ast_reentrancy_init(&t->
track);
218 ast_reentrancy_lock(lt);
223 ast_reentrancy_unlock(lt);
225 ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
227 ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
232 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
234 time_t seconds = time(NULL);
235 time_t wait_time, reported_wait = 0;
237 #ifdef HAVE_MTX_PROFILE
241 #ifdef HAVE_MTX_PROFILE
245 wait_time = time(NULL) - seconds;
246 if (wait_time > reported_wait && (wait_time % 5) == 0) {
247 __ast_mutex_logger(
"%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
248 filename, lineno, func, (
int) wait_time, mutex_name);
249 ast_reentrancy_lock(lt);
253 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
259 ast_reentrancy_unlock(lt);
260 reported_wait = wait_time;
264 }
while (res == EBUSY);
267 #ifdef HAVE_MTX_PROFILE
278 ast_reentrancy_lock(lt);
286 __ast_mutex_logger(
"%s line %d (%s): '%s' really deep reentrancy!\n",
287 filename, lineno, func, mutex_name);
289 ast_reentrancy_unlock(lt);
291 ast_mark_lock_acquired(t);
296 ast_reentrancy_lock(lt);
298 ast_reentrancy_unlock(lt);
302 ast_remove_lock_info(t, bt);
304 ast_remove_lock_info(t);
308 __ast_mutex_logger(
"%s line %d (%s): Error obtaining mutex: %s\n",
309 filename, lineno, func, strerror(res));
324 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
329 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
337 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized and unable to initialize.\n",
338 filename, lineno, func, mutex_name);
345 ast_reentrancy_init(&t->
track);
358 ast_reentrancy_lock(lt);
363 ast_reentrancy_unlock(lt);
365 ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
367 ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
376 ast_reentrancy_lock(lt);
384 __ast_mutex_logger(
"%s line %d (%s): '%s' really deep reentrancy!\n",
385 filename, lineno, func, mutex_name);
387 ast_reentrancy_unlock(lt);
389 ast_mark_lock_acquired(t);
392 ast_mark_lock_failed(t);
406 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
411 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
413 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
414 filename, lineno, func, mutex_name);
417 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized and unable to initialize.\n",
418 filename, lineno, func, mutex_name);
425 ast_reentrancy_init(&t->
track);
430 ast_reentrancy_lock(lt);
432 __ast_mutex_logger(
"%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
433 filename, lineno, func, mutex_name);
434 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
443 __ast_mutex_logger(
"%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
444 filename, lineno, func, mutex_name);
460 ast_reentrancy_unlock(lt);
463 ast_remove_lock_info(t, bt);
465 ast_remove_lock_info(t);
474 __ast_mutex_logger(
"%s line %d (%s): Error releasing mutex: %s\n",
475 filename, lineno, func, strerror(res));
485 const char *cond_name,
ast_cond_t *
cond, pthread_condattr_t *cond_attr)
509 const char *cond_name,
const char *mutex_name,
517 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
519 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
521 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
522 filename, lineno, func, mutex_name);
525 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized and unable to initialize.\n",
526 filename, lineno, func, mutex_name);
533 ast_reentrancy_init(&t->
track);
538 ast_reentrancy_lock(lt);
540 __ast_mutex_logger(
"%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
541 filename, lineno, func, mutex_name);
542 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
549 __ast_mutex_logger(
"%s line %d (%s): attempted to wait on an unlocked mutex '%s'\n",
550 filename, lineno, func, mutex_name);
559 ast_reentrancy_unlock(lt);
561 ast_suspend_lock_info(t);
569 __ast_mutex_logger(
"%s line %d (%s): Error waiting on condition mutex '%s'\n",
570 filename, lineno, func, strerror(res));
574 ast_reentrancy_lock(lt);
580 ast_reentrancy_unlock(lt);
582 ast_restore_lock_info(t);
598 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
600 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
602 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
603 filename, lineno, func, mutex_name);
606 __ast_mutex_logger(
"%s line %d (%s): Error: mutex '%s' is uninitialized and unable to initialize.\n",
607 filename, lineno, func, mutex_name);
614 ast_reentrancy_init(&t->
track);
619 ast_reentrancy_lock(lt);
621 __ast_mutex_logger(
"%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
622 filename, lineno, func, mutex_name);
623 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
630 __ast_mutex_logger(
"%s line %d (%s): attempted to wait on an unlocked mutex '%s'\n",
631 filename, lineno, func, mutex_name);
640 ast_reentrancy_unlock(lt);
642 ast_suspend_lock_info(t);
649 if (res && (res != ETIMEDOUT)) {
650 __ast_mutex_logger(
"%s line %d (%s): Error waiting on condition mutex '%s'\n",
651 filename, lineno, func, strerror(res));
655 ast_reentrancy_lock(lt);
661 ast_reentrancy_unlock(lt);
663 ast_suspend_lock_info(t);
673 pthread_rwlockattr_t attr;
677 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
678 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
681 __ast_mutex_logger(
"%s line %d (%s): Warning: rwlock '%s' is already initialized.\n",
682 filename, lineno, func, rwlock_name);
688 ast_reentrancy_init(&t->
track);
692 pthread_rwlockattr_init(&attr);
694 #ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP
695 pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP);
698 res = pthread_rwlock_init(&t->
lock, &attr);
699 pthread_rwlockattr_destroy(&attr);
709 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
711 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
713 __ast_mutex_logger(
"%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
714 filename, lineno, func, rwlock_name);
721 res = pthread_rwlock_destroy(&t->
lock);
725 __ast_mutex_logger(
"%s line %d (%s): Error destroying rwlock %s: %s\n",
726 filename, lineno, func, rwlock_name, strerror(res));
729 ast_reentrancy_lock(lt);
730 lt->
file[0] = filename;
738 ast_reentrancy_unlock(lt);
739 delete_reentrancy_cs(&t->
track);
752 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
759 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
761 __ast_mutex_logger(
"%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
762 filename, line, func, name);
764 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
765 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
766 filename, line, func, name);
773 ast_reentrancy_init(&t->
track);
778 ast_reentrancy_lock(lt);
781 pthread_t
self = pthread_self();
783 if (lt->
thread[i] ==
self) {
804 __ast_mutex_logger(
"%s line %d (%s): rwlock '%s' freed more times than we've locked!\n",
805 filename, line, func, name);
809 ast_reentrancy_unlock(lt);
812 ast_remove_lock_info(t, bt);
814 ast_remove_lock_info(t);
819 res = pthread_rwlock_unlock(&t->
lock);
823 __ast_mutex_logger(
"%s line %d (%s): Error releasing rwlock: %s\n",
824 filename, line, func, strerror(res));
838 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
843 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
850 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
851 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
852 filename, line, func, name);
859 ast_reentrancy_init(&t->
track);
872 ast_reentrancy_lock(lt);
877 ast_reentrancy_unlock(lt);
879 ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
881 ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
886 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
888 time_t seconds = time(NULL);
889 time_t wait_time, reported_wait = 0;
891 res = pthread_rwlock_tryrdlock(&t->
lock);
893 wait_time = time(NULL) - seconds;
894 if (wait_time > reported_wait && (wait_time % 5) == 0) {
895 __ast_mutex_logger(
"%s line %d (%s): Deadlock? waited %d sec for readlock '%s'?\n",
896 filename, line, func, (
int)wait_time, name);
898 ast_reentrancy_lock(lt);
902 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
908 ast_reentrancy_unlock(lt);
910 reported_wait = wait_time;
914 }
while (res == EBUSY);
917 res = pthread_rwlock_rdlock(&t->
lock);
922 ast_reentrancy_lock(lt);
930 ast_reentrancy_unlock(lt);
932 ast_mark_lock_acquired(t);
937 ast_reentrancy_lock(lt);
939 ast_reentrancy_unlock(lt);
943 ast_remove_lock_info(t, bt);
945 ast_remove_lock_info(t);
950 __ast_mutex_logger(
"%s line %d (%s): Error obtaining read lock: %s\n",
951 filename, line, func, strerror(res));
965 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
970 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
977 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
978 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
979 filename, line, func, name);
986 ast_reentrancy_init(&t->
track);
999 ast_reentrancy_lock(lt);
1004 ast_reentrancy_unlock(lt);
1006 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1008 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
1013 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
1015 time_t seconds = time(NULL);
1016 time_t wait_time, reported_wait = 0;
1018 res = pthread_rwlock_trywrlock(&t->
lock);
1020 wait_time = time(NULL) - seconds;
1021 if (wait_time > reported_wait && (wait_time % 5) == 0) {
1022 __ast_mutex_logger(
"%s line %d (%s): Deadlock? waited %d sec for writelock '%s'?\n",
1023 filename, line, func, (
int)wait_time, name);
1025 ast_reentrancy_lock(lt);
1029 __ast_mutex_logger(
"%s line %d (%s): '%s' was locked here.\n",
1035 ast_reentrancy_unlock(lt);
1037 reported_wait = wait_time;
1041 }
while (res == EBUSY);
1044 res = pthread_rwlock_wrlock(&t->
lock);
1047 #ifdef DEBUG_THREADS
1049 ast_reentrancy_lock(lt);
1057 ast_reentrancy_unlock(lt);
1059 ast_mark_lock_acquired(t);
1064 ast_reentrancy_lock(lt);
1066 ast_reentrancy_unlock(lt);
1071 ast_remove_lock_info(t, bt);
1075 ast_remove_lock_info(t);
1080 __ast_mutex_logger(
"%s line %d (%s): Error obtaining write lock: %s\n",
1081 filename, line, func, strerror(res));
1090 const struct timespec *abs_timeout)
1094 #ifdef DEBUG_THREADS
1096 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
1098 struct ast_bt *bt = NULL;
1101 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
1108 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
1109 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
1110 filename, line, func, name);
1117 ast_reentrancy_init(&t->
track);
1130 ast_reentrancy_lock(lt);
1135 ast_reentrancy_unlock(lt);
1137 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1139 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
1144 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
1145 res = pthread_rwlock_timedrdlock(&t->
lock, abs_timeout);
1148 struct timeval _now;
1150 if (!(res = pthread_rwlock_tryrdlock(&t->
lock))) {
1154 if (_now.tv_sec > abs_timeout->tv_sec || (_now.tv_sec == abs_timeout->tv_sec && _now.tv_usec * 1000 > abs_timeout->tv_nsec)) {
1162 #ifdef DEBUG_THREADS
1164 ast_reentrancy_lock(lt);
1172 ast_reentrancy_unlock(lt);
1174 ast_mark_lock_acquired(t);
1179 ast_reentrancy_lock(lt);
1181 ast_reentrancy_unlock(lt);
1185 ast_remove_lock_info(t, bt);
1187 ast_remove_lock_info(t);
1191 __ast_mutex_logger(
"%s line %d (%s): Error obtaining read lock: %s\n",
1192 filename, line, func, strerror(res));
1201 const struct timespec *abs_timeout)
1205 #ifdef DEBUG_THREADS
1207 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
1209 struct ast_bt *bt = NULL;
1212 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
1219 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
1220 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
1221 filename, line, func, name);
1228 ast_reentrancy_init(&t->
track);
1241 ast_reentrancy_lock(lt);
1246 ast_reentrancy_unlock(lt);
1248 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1250 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
1255 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
1256 res = pthread_rwlock_timedwrlock(&t->
lock, abs_timeout);
1259 struct timeval _now;
1261 if (!(res = pthread_rwlock_trywrlock(&t->
lock))) {
1265 if (_now.tv_sec > abs_timeout->tv_sec || (_now.tv_sec == abs_timeout->tv_sec && _now.tv_usec * 1000 > abs_timeout->tv_nsec)) {
1273 #ifdef DEBUG_THREADS
1275 ast_reentrancy_lock(lt);
1283 ast_reentrancy_unlock(lt);
1285 ast_mark_lock_acquired(t);
1290 ast_reentrancy_lock(lt);
1292 ast_reentrancy_unlock(lt);
1297 ast_remove_lock_info(t, bt);
1301 ast_remove_lock_info(t);
1306 __ast_mutex_logger(
"%s line %d (%s): Error obtaining read lock: %s\n",
1307 filename, line, func, strerror(res));
1319 #ifdef DEBUG_THREADS
1322 struct ast_bt *bt = NULL;
1324 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
1325 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
1333 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
1334 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
1335 filename, line, func, name);
1342 ast_reentrancy_init(&t->
track);
1355 ast_reentrancy_lock(lt);
1360 ast_reentrancy_unlock(lt);
1362 ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
1364 ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
1369 res = pthread_rwlock_tryrdlock(&t->
lock);
1371 #ifdef DEBUG_THREADS
1373 ast_reentrancy_lock(lt);
1381 ast_reentrancy_unlock(lt);
1383 ast_mark_lock_acquired(t);
1386 ast_mark_lock_failed(t);
1397 #ifdef DEBUG_THREADS
1400 struct ast_bt *bt = NULL;
1402 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
1403 int canlog = strcmp(filename,
"logger.c") & t->
tracking;
1411 if ((t->
lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
1412 __ast_mutex_logger(
"%s line %d (%s): Error: rwlock '%s' is uninitialized and unable to initialize.\n",
1413 filename, line, func, name);
1420 ast_reentrancy_init(&t->
track);
1433 ast_reentrancy_lock(lt);
1438 ast_reentrancy_unlock(lt);
1440 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1442 ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
1447 res = pthread_rwlock_trywrlock(&t->
lock);
1449 #ifdef DEBUG_THREADS
1451 ast_reentrancy_lock(lt);
1459 ast_reentrancy_unlock(lt);
1460 ast_mark_lock_acquired(t);
1462 ast_mark_lock_failed(t);
int __ast_cond_init(const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond, pthread_condattr_t *cond_attr)
void ast_std_free(void *ptr)
#define pthread_mutex_init
pthread_t thread[AST_MAX_REENTRANCY]
int64_t ast_mark(int, int start1_stop0)
Asterisk locking-related definitions:
int __ast_rwlock_timedrdlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name, const struct timespec *abs_timeout)
Asterisk main include file. File version handling, generic pbx functions.
int __ast_rwlock_trywrlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
const char * file[AST_MAX_REENTRANCY]
int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
#define pthread_cond_init
#define __AST_RWLOCK_INIT_VALUE
int __ast_rwlock_rdlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
int __ast_rwlock_timedwrlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name, const struct timespec *abs_timeout)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int __ast_pthread_mutex_init(int tracking, const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_rwlock_unlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
int lineno[AST_MAX_REENTRANCY]
struct ast_bt backtrace[AST_MAX_REENTRANCY]
struct ast_lock_track * track
pthread_cond_t ast_cond_t
#define pthread_mutex_destroy
int __ast_cond_timedwait(const char *filename, int lineno, const char *func, const char *cond_name, const char *mutex_name, ast_cond_t *cond, ast_mutex_t *t, const struct timespec *abstime)
#define pthread_cond_wait
int __ast_cond_wait(const char *filename, int lineno, const char *func, const char *cond_name, const char *mutex_name, ast_cond_t *cond, ast_mutex_t *t)
#define pthread_mutex_lock
#define pthread_cond_broadcast
#define AST_PTHREADT_NULL
int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_cond_broadcast(const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
const char * func[AST_MAX_REENTRANCY]
int __ast_cond_destroy(const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
int __ast_rwlock_destroy(const char *filename, int lineno, const char *func, const char *rwlock_name, ast_rwlock_t *t)
void * addresses[AST_MAX_BT_FRAMES]
int __ast_rwlock_wrlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
#define AST_MAX_REENTRANCY
#define pthread_cond_signal
Structure for rwlock and tracking information.
int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_rwlock_init(int tracking, const char *filename, int lineno, const char *func, const char *rwlock_name, ast_rwlock_t *t)
int ast_bt_get_addresses(struct ast_bt *bt)
int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
pthread_mutex_t reentr_mutex
int __ast_cond_signal(const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
#define pthread_mutex_unlock
#define pthread_cond_timedwait
int __ast_rwlock_tryrdlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
#define pthread_mutex_trylock
#define pthread_cond_destroy
Structure for mutex and tracking information.
struct ast_lock_track * track
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.