mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-09 06:28:14 +00:00
Totally revamp thread debugging to support locating and removing deadlocks
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -152,7 +152,7 @@ void ast_unregister_atexit(void (*func)(void));
|
||||
struct localuser *next; \
|
||||
}
|
||||
|
||||
#define LOCAL_USER_DECL static pthread_mutex_t localuser_lock = AST_MUTEX_INITIALIZER; \
|
||||
#define LOCAL_USER_DECL static ast_mutex_t localuser_lock = AST_MUTEX_INITIALIZER; \
|
||||
static struct localuser *localusers = NULL; \
|
||||
static int localusecnt = 0;
|
||||
|
||||
@@ -162,18 +162,18 @@ void ast_unregister_atexit(void (*func)(void));
|
||||
ast_log(LOG_WARNING, "Out of memory\n"); \
|
||||
return -1; \
|
||||
} \
|
||||
pthread_mutex_lock(&localuser_lock); \
|
||||
ast_mutex_lock(&localuser_lock); \
|
||||
u->chan = chan; \
|
||||
u->next = localusers; \
|
||||
localusers = u; \
|
||||
localusecnt++; \
|
||||
pthread_mutex_unlock(&localuser_lock); \
|
||||
ast_mutex_unlock(&localuser_lock); \
|
||||
ast_update_use_count(); \
|
||||
}
|
||||
|
||||
#define LOCAL_USER_REMOVE(u) { \
|
||||
struct localuser *uc, *ul = NULL; \
|
||||
pthread_mutex_lock(&localuser_lock); \
|
||||
ast_mutex_lock(&localuser_lock); \
|
||||
uc = localusers; \
|
||||
while (uc) { \
|
||||
if (uc == u) { \
|
||||
@@ -188,13 +188,13 @@ void ast_unregister_atexit(void (*func)(void));
|
||||
}\
|
||||
free(u); \
|
||||
localusecnt--; \
|
||||
pthread_mutex_unlock(&localuser_lock); \
|
||||
ast_mutex_unlock(&localuser_lock); \
|
||||
ast_update_use_count(); \
|
||||
}
|
||||
|
||||
#define STANDARD_HANGUP_LOCALUSERS { \
|
||||
struct localuser *u, *ul; \
|
||||
pthread_mutex_lock(&localuser_lock); \
|
||||
ast_mutex_lock(&localuser_lock); \
|
||||
u = localusers; \
|
||||
while(u) { \
|
||||
ast_softhangup(u->chan, AST_SOFTHANGUP_APPUNLOAD); \
|
||||
@@ -202,14 +202,14 @@ void ast_unregister_atexit(void (*func)(void));
|
||||
u = u->next; \
|
||||
free(ul); \
|
||||
} \
|
||||
pthread_mutex_unlock(&localuser_lock); \
|
||||
ast_mutex_unlock(&localuser_lock); \
|
||||
localusecnt=0; \
|
||||
}
|
||||
|
||||
#define STANDARD_USECOUNT(res) { \
|
||||
pthread_mutex_lock(&localuser_lock); \
|
||||
ast_mutex_lock(&localuser_lock); \
|
||||
res = localusecnt; \
|
||||
pthread_mutex_unlock(&localuser_lock); \
|
||||
ast_mutex_unlock(&localuser_lock); \
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user