mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +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:
14
image.c
14
image.c
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user