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:
Mark Spencer
2003-08-13 15:25:16 +00:00
parent 4a396046fe
commit 1bb58646de
76 changed files with 1789 additions and 1723 deletions

14
image.c
View File

@@ -33,23 +33,23 @@
#include "astconf.h"
static struct ast_imager *list;
static pthread_mutex_t listlock = AST_MUTEX_INITIALIZER;
static ast_mutex_t listlock = AST_MUTEX_INITIALIZER;
int ast_image_register(struct ast_imager *img)
{
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Registered format '%s' (%s)\n", img->name, img->desc);
ast_pthread_mutex_lock(&listlock);
ast_mutex_lock(&listlock);
img->next = list;
list = img;
ast_pthread_mutex_unlock(&listlock);
ast_mutex_unlock(&listlock);
return 0;
}
void ast_image_unregister(struct ast_imager *img)
{
struct ast_imager *i, *prev = NULL;
ast_pthread_mutex_lock(&listlock);
ast_mutex_lock(&listlock);
i = list;
while(i) {
if (i == img) {
@@ -62,7 +62,7 @@ void ast_image_unregister(struct ast_imager *img)
prev = i;
i = i->next;
}
ast_pthread_mutex_unlock(&listlock);
ast_mutex_unlock(&listlock);
if (i && (option_verbose > 1))
ast_verbose(VERBOSE_PREFIX_2 "Registered format '%s' (%s)\n", img->name, img->desc);
}
@@ -112,7 +112,7 @@ struct ast_frame *ast_read_image(char *filename, char *preflang, int format)
int len=0;
struct ast_frame *f = NULL;
#if 0 /* We need to have some sort of read-only lock */
ast_pthread_mutex_lock(&listlock);
ast_mutex_lock(&listlock);
#endif
i = list;
while(!found && i) {
@@ -152,7 +152,7 @@ struct ast_frame *ast_read_image(char *filename, char *preflang, int format)
} else
ast_log(LOG_WARNING, "Image file '%s' not found\n", filename);
#if 0
ast_pthread_mutex_unlock(&listlock);
ast_mutex_unlock(&listlock);
#endif
return f;
}