diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 15:25:16 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 15:25:16 +0000 |
commit | dbc9edcaac6ec1d2059f4c5bcd27cca6c266f5bf (patch) | |
tree | 3f2cc11c392b1496cf6518e8b6eb99e8b04417a1 /formats | |
parent | 231b9aad4020331a8c68d1a2826ee1ef930ec57b (diff) |
Totally revamp thread debugging to support locating and removing deadlocks
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1310 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'formats')
-rwxr-xr-x | formats/format_g723.c | 22 | ||||
-rwxr-xr-x | formats/format_g729.c | 18 | ||||
-rwxr-xr-x | formats/format_gsm.c | 18 | ||||
-rwxr-xr-x | formats/format_h263.c | 18 | ||||
-rwxr-xr-x | formats/format_mp3.c | 18 | ||||
-rwxr-xr-x | formats/format_pcm.c | 18 | ||||
-rwxr-xr-x | formats/format_pcm_alaw.c | 18 | ||||
-rwxr-xr-x | formats/format_vox.c | 18 | ||||
-rwxr-xr-x | formats/format_wav.c | 18 | ||||
-rwxr-xr-x | formats/format_wav_gsm.c | 16 |
10 files changed, 91 insertions, 91 deletions
diff --git a/formats/format_g723.c b/formats/format_g723.c index 8ce2ec266..2431d3dee 100755 --- a/formats/format_g723.c +++ b/formats/format_g723.c @@ -42,7 +42,7 @@ struct ast_filestream { }; -static pthread_mutex_t g723_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t g723_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "g723sf"; @@ -56,7 +56,7 @@ static struct ast_filestream *g723_open(int fd) and be sure it's a valid file. */ struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { - if (ast_pthread_mutex_lock(&g723_lock)) { + if (ast_mutex_lock(&g723_lock)) { ast_log(LOG_WARNING, "Unable to lock g723 list\n"); free(tmp); return NULL; @@ -73,7 +73,7 @@ static struct ast_filestream *g723_open(int fd) tmp->orig.tv_usec = 0; tmp->orig.tv_sec = 0; glistcnt++; - ast_pthread_mutex_unlock(&g723_lock); + ast_mutex_unlock(&g723_lock); ast_update_use_count(); } return tmp; @@ -86,7 +86,7 @@ static struct ast_filestream *g723_rewrite(int fd, char *comment) and be sure it's a valid file. */ struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { - if (ast_pthread_mutex_lock(&g723_lock)) { + if (ast_mutex_lock(&g723_lock)) { ast_log(LOG_WARNING, "Unable to lock g723 list\n"); free(tmp); return NULL; @@ -98,7 +98,7 @@ static struct ast_filestream *g723_rewrite(int fd, char *comment) tmp->orig.tv_usec = 0; tmp->orig.tv_sec = 0; glistcnt++; - ast_pthread_mutex_unlock(&g723_lock); + ast_mutex_unlock(&g723_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -113,7 +113,7 @@ static struct ast_frame *g723_read(struct ast_filestream *s) static void g723_close(struct ast_filestream *s) { struct ast_filestream *tmp, *tmpl = NULL; - if (ast_pthread_mutex_lock(&g723_lock)) { + if (ast_mutex_lock(&g723_lock)) { ast_log(LOG_WARNING, "Unable to lock g723 list\n"); return; } @@ -136,7 +136,7 @@ static void g723_close(struct ast_filestream *s) ast_sched_del(s->owner->sched, s->owner->streamid); s->owner->streamid = -1; } - ast_pthread_mutex_unlock(&g723_lock); + ast_mutex_unlock(&g723_lock); ast_update_use_count(); if (!tmp) ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n"); @@ -335,7 +335,7 @@ int load_module() int unload_module() { struct ast_filestream *tmp, *tmpl; - if (ast_pthread_mutex_lock(&g723_lock)) { + if (ast_mutex_lock(&g723_lock)) { ast_log(LOG_WARNING, "Unable to lock g723 list\n"); return -1; } @@ -347,19 +347,19 @@ int unload_module() tmp = tmp->next; free(tmpl); } - ast_pthread_mutex_unlock(&g723_lock); + ast_mutex_unlock(&g723_lock); return ast_format_unregister(name); } int usecount() { int res; - if (ast_pthread_mutex_lock(&g723_lock)) { + if (ast_mutex_lock(&g723_lock)) { ast_log(LOG_WARNING, "Unable to lock g723 list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&g723_lock); + ast_mutex_unlock(&g723_lock); return res; } diff --git a/formats/format_g729.c b/formats/format_g729.c index a2336c94b..81765985f 100755 --- a/formats/format_g729.c +++ b/formats/format_g729.c @@ -48,7 +48,7 @@ struct ast_filestream { }; -static pthread_mutex_t g729_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t g729_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "g729"; @@ -63,7 +63,7 @@ static struct ast_filestream *g729_open(int fd) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&g729_lock)) { + if (ast_mutex_lock(&g729_lock)) { ast_log(LOG_WARNING, "Unable to lock g729 list\n"); free(tmp); return NULL; @@ -76,7 +76,7 @@ static struct ast_filestream *g729_open(int fd) tmp->fr.src = name; tmp->fr.mallocd = 0; glistcnt++; - ast_pthread_mutex_unlock(&g729_lock); + ast_mutex_unlock(&g729_lock); ast_update_use_count(); } return tmp; @@ -90,14 +90,14 @@ static struct ast_filestream *g729_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&g729_lock)) { + if (ast_mutex_lock(&g729_lock)) { ast_log(LOG_WARNING, "Unable to lock g729 list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&g729_lock); + ast_mutex_unlock(&g729_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -106,12 +106,12 @@ static struct ast_filestream *g729_rewrite(int fd, char *comment) static void g729_close(struct ast_filestream *s) { - if (ast_pthread_mutex_lock(&g729_lock)) { + if (ast_mutex_lock(&g729_lock)) { ast_log(LOG_WARNING, "Unable to lock g729 list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&g729_lock); + ast_mutex_unlock(&g729_lock); ast_update_use_count(); close(s->fd); free(s); @@ -226,12 +226,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&g729_lock)) { + if (ast_mutex_lock(&g729_lock)) { ast_log(LOG_WARNING, "Unable to lock g729 list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&g729_lock); + ast_mutex_unlock(&g729_lock); return res; } diff --git a/formats/format_gsm.c b/formats/format_gsm.c index 49d53df27..078d79d33 100755 --- a/formats/format_gsm.c +++ b/formats/format_gsm.c @@ -50,7 +50,7 @@ struct ast_filestream { }; -static pthread_mutex_t gsm_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t gsm_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "gsm"; @@ -65,7 +65,7 @@ static struct ast_filestream *gsm_open(int fd) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&gsm_lock)) { + if (ast_mutex_lock(&gsm_lock)) { ast_log(LOG_WARNING, "Unable to lock gsm list\n"); free(tmp); return NULL; @@ -78,7 +78,7 @@ static struct ast_filestream *gsm_open(int fd) tmp->fr.src = name; tmp->fr.mallocd = 0; glistcnt++; - ast_pthread_mutex_unlock(&gsm_lock); + ast_mutex_unlock(&gsm_lock); ast_update_use_count(); } return tmp; @@ -92,14 +92,14 @@ static struct ast_filestream *gsm_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&gsm_lock)) { + if (ast_mutex_lock(&gsm_lock)) { ast_log(LOG_WARNING, "Unable to lock gsm list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&gsm_lock); + ast_mutex_unlock(&gsm_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -108,12 +108,12 @@ static struct ast_filestream *gsm_rewrite(int fd, char *comment) static void gsm_close(struct ast_filestream *s) { - if (ast_pthread_mutex_lock(&gsm_lock)) { + if (ast_mutex_lock(&gsm_lock)) { ast_log(LOG_WARNING, "Unable to lock gsm list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&gsm_lock); + ast_mutex_unlock(&gsm_lock); ast_update_use_count(); close(s->fd); free(s); @@ -235,12 +235,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&gsm_lock)) { + if (ast_mutex_lock(&gsm_lock)) { ast_log(LOG_WARNING, "Unable to lock gsm list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&gsm_lock); + ast_mutex_unlock(&gsm_lock); return res; } diff --git a/formats/format_h263.c b/formats/format_h263.c index 19a57ed5a..6e0f8edad 100755 --- a/formats/format_h263.c +++ b/formats/format_h263.c @@ -49,7 +49,7 @@ struct ast_filestream { }; -static pthread_mutex_t h263_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t h263_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "h263"; @@ -71,7 +71,7 @@ static struct ast_filestream *h263_open(int fd) if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&h263_lock)) { + if (ast_mutex_lock(&h263_lock)) { ast_log(LOG_WARNING, "Unable to lock h263 list\n"); free(tmp); return NULL; @@ -84,7 +84,7 @@ static struct ast_filestream *h263_open(int fd) tmp->fr.src = name; tmp->fr.mallocd = 0; glistcnt++; - ast_pthread_mutex_unlock(&h263_lock); + ast_mutex_unlock(&h263_lock); ast_update_use_count(); } return tmp; @@ -98,14 +98,14 @@ static struct ast_filestream *h263_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&h263_lock)) { + if (ast_mutex_lock(&h263_lock)) { ast_log(LOG_WARNING, "Unable to lock h263 list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&h263_lock); + ast_mutex_unlock(&h263_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -114,12 +114,12 @@ static struct ast_filestream *h263_rewrite(int fd, char *comment) static void h263_close(struct ast_filestream *s) { - if (ast_pthread_mutex_lock(&h263_lock)) { + if (ast_mutex_lock(&h263_lock)) { ast_log(LOG_WARNING, "Unable to lock h263 list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&h263_lock); + ast_mutex_unlock(&h263_lock); ast_update_use_count(); close(s->fd); free(s); @@ -250,12 +250,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&h263_lock)) { + if (ast_mutex_lock(&h263_lock)) { ast_log(LOG_WARNING, "Unable to lock h263 list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&h263_lock); + ast_mutex_unlock(&h263_lock); return res; } diff --git a/formats/format_mp3.c b/formats/format_mp3.c index 7f6b6992c..bff51d686 100755 --- a/formats/format_mp3.c +++ b/formats/format_mp3.c @@ -43,7 +43,7 @@ struct ast_filestream { static struct ast_filestream *glist = NULL; -static pthread_mutex_t mp3_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t mp3_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "mp3"; @@ -59,7 +59,7 @@ static struct ast_filestream *mp3_open(int fd) and be sure it's a valid file. */ struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { - if (ast_pthread_mutex_lock(&mp3_lock)) { + if (ast_mutex_lock(&mp3_lock)) { ast_log(LOG_WARNING, "Unable to lock mp3 list\n"); free(tmp); return NULL; @@ -68,7 +68,7 @@ static struct ast_filestream *mp3_open(int fd) tmp->last.tv_usec = 0; tmp->last.tv_sec = 0; glistcnt++; - ast_pthread_mutex_unlock(&mp3_lock); + ast_mutex_unlock(&mp3_lock); ast_update_use_count(); } return tmp; @@ -81,14 +81,14 @@ static struct ast_filestream *mp3_rewrite(int fd, char *comment) and be sure it's a valid file. */ struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { - if (ast_pthread_mutex_lock(&mp3_lock)) { + if (ast_mutex_lock(&mp3_lock)) { ast_log(LOG_WARNING, "Unable to lock mp3 list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&mp3_lock); + ast_mutex_unlock(&mp3_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -97,12 +97,12 @@ static struct ast_filestream *mp3_rewrite(int fd, char *comment) static void mp3_close(struct ast_filestream *s) { - if (ast_pthread_mutex_lock(&mp3_lock)) { + if (ast_mutex_lock(&mp3_lock)) { ast_log(LOG_WARNING, "Unable to lock mp3 list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&mp3_lock); + ast_mutex_unlock(&mp3_lock); ast_update_use_count(); close(s->fd); free(s); @@ -213,12 +213,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&mp3_lock)) { + if (ast_mutex_lock(&mp3_lock)) { ast_log(LOG_WARNING, "Unable to lock mp3 list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&mp3_lock); + ast_mutex_unlock(&mp3_lock); return res; } diff --git a/formats/format_pcm.c b/formats/format_pcm.c index fe384ca5f..ab3ba2205 100755 --- a/formats/format_pcm.c +++ b/formats/format_pcm.c @@ -46,7 +46,7 @@ struct ast_filestream { }; -static pthread_mutex_t pcm_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t pcm_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "pcm"; @@ -61,7 +61,7 @@ static struct ast_filestream *pcm_open(int fd) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); free(tmp); return NULL; @@ -74,7 +74,7 @@ static struct ast_filestream *pcm_open(int fd) tmp->fr.src = name; tmp->fr.mallocd = 0; glistcnt++; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); } return tmp; @@ -88,14 +88,14 @@ static struct ast_filestream *pcm_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -104,11 +104,11 @@ static struct ast_filestream *pcm_rewrite(int fd, char *comment) static void pcm_close(struct ast_filestream *s) { - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); return; } - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); close(s->fd); free(s); @@ -215,12 +215,12 @@ int unload_module() int usecount() { int res; - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); return -1; } res = glistcnt; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); return res; } diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c index ef17680d7..abc450f24 100755 --- a/formats/format_pcm_alaw.c +++ b/formats/format_pcm_alaw.c @@ -53,7 +53,7 @@ struct ast_filestream { }; -static pthread_mutex_t pcm_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t pcm_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "alaw"; @@ -84,7 +84,7 @@ static struct ast_filestream *pcm_open(int fd) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); free(tmp); return NULL; @@ -100,7 +100,7 @@ static struct ast_filestream *pcm_open(int fd) tmp->start_time = get_time(); #endif glistcnt++; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); } return tmp; @@ -114,7 +114,7 @@ static struct ast_filestream *pcm_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); free(tmp); return NULL; @@ -124,7 +124,7 @@ static struct ast_filestream *pcm_rewrite(int fd, char *comment) tmp->start_time = get_time(); #endif glistcnt++; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -133,12 +133,12 @@ static struct ast_filestream *pcm_rewrite(int fd, char *comment) static void pcm_close(struct ast_filestream *s) { - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); return; } glistcnt--; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); ast_update_use_count(); close(s->fd); free(s); @@ -293,12 +293,12 @@ int unload_module() int usecount() { int res; - if (pthread_mutex_lock(&pcm_lock)) { + if (ast_mutex_lock(&pcm_lock)) { ast_log(LOG_WARNING, "Unable to lock pcm list\n"); return -1; } res = glistcnt; - pthread_mutex_unlock(&pcm_lock); + ast_mutex_unlock(&pcm_lock); return res; } diff --git a/formats/format_vox.c b/formats/format_vox.c index 00c8e16eb..9ea35ffd5 100755 --- a/formats/format_vox.c +++ b/formats/format_vox.c @@ -48,7 +48,7 @@ struct ast_filestream { }; -static pthread_mutex_t vox_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t vox_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "vox"; @@ -171,7 +171,7 @@ static struct ast_filestream *vox_open(int fd) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&vox_lock)) { + if (ast_mutex_lock(&vox_lock)) { ast_log(LOG_WARNING, "Unable to lock vox list\n"); free(tmp); return NULL; @@ -185,7 +185,7 @@ static struct ast_filestream *vox_open(int fd) tmp->fr.mallocd = 0; tmp->lasttimeout = -1; glistcnt++; - ast_pthread_mutex_unlock(&vox_lock); + ast_mutex_unlock(&vox_lock); ast_update_use_count(); } return tmp; @@ -199,14 +199,14 @@ static struct ast_filestream *vox_rewrite(int fd, char *comment) struct ast_filestream *tmp; if ((tmp = malloc(sizeof(struct ast_filestream)))) { memset(tmp, 0, sizeof(struct ast_filestream)); - if (ast_pthread_mutex_lock(&vox_lock)) { + if (ast_mutex_lock(&vox_lock)) { ast_log(LOG_WARNING, "Unable to lock vox list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&vox_lock); + ast_mutex_unlock(&vox_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -215,12 +215,12 @@ static struct ast_filestream *vox_rewrite(int fd, char *comment) static void vox_close(struct ast_filestream *s) { - if (ast_pthread_mutex_lock(&vox_lock)) { + if (ast_mutex_lock(&vox_lock)) { ast_log(LOG_WARNING, "Unable to lock vox list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&vox_lock); + ast_mutex_unlock(&vox_lock); ast_update_use_count(); close(s->fd); free(s); @@ -324,12 +324,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&vox_lock)) { + if (ast_mutex_lock(&vox_lock)) { ast_log(LOG_WARNING, "Unable to lock vox list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&vox_lock); + ast_mutex_unlock(&vox_lock); return res; } diff --git a/formats/format_wav.c b/formats/format_wav.c index c80d47e74..3771df354 100755 --- a/formats/format_wav.c +++ b/formats/format_wav.c @@ -52,7 +52,7 @@ struct ast_filestream { }; -static pthread_mutex_t wav_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t wav_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "wav"; @@ -312,7 +312,7 @@ static struct ast_filestream *wav_open(int fd) free(tmp); return NULL; } - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); free(tmp); return NULL; @@ -327,7 +327,7 @@ static struct ast_filestream *wav_open(int fd) tmp->fr.mallocd = 0; tmp->bytes = 0; glistcnt++; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); } return tmp; @@ -345,14 +345,14 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment) free(tmp); return NULL; } - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -362,12 +362,12 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment) static void wav_close(struct ast_filestream *s) { char zero = 0; - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); return; } glistcnt--; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); /* Pad to even length */ if (s->bytes & 0x1) @@ -554,12 +554,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); return res; } diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c index a9a1e8313..fbb97d6ab 100755 --- a/formats/format_wav_gsm.c +++ b/formats/format_wav_gsm.c @@ -53,7 +53,7 @@ struct ast_filestream { }; -static pthread_mutex_t wav_lock = AST_MUTEX_INITIALIZER; +static ast_mutex_t wav_lock = AST_MUTEX_INITIALIZER; static int glistcnt = 0; static char *name = "wav49"; @@ -331,7 +331,7 @@ static struct ast_filestream *wav_open(int fd) free(tmp); return NULL; } - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); free(tmp); return NULL; @@ -345,7 +345,7 @@ static struct ast_filestream *wav_open(int fd) tmp->fr.mallocd = 0; tmp->secondhalf = 0; glistcnt++; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); } return tmp; @@ -363,14 +363,14 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment) free(tmp); return NULL; } - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); free(tmp); return NULL; } tmp->fd = fd; glistcnt++; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); } else ast_log(LOG_WARNING, "Out of memory\n"); @@ -380,7 +380,7 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment) static void wav_close(struct ast_filestream *s) { char zero = 0; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); ast_update_use_count(); /* Pad to even length */ if (s->bytes & 0x1) @@ -533,12 +533,12 @@ int unload_module() int usecount() { int res; - if (ast_pthread_mutex_lock(&wav_lock)) { + if (ast_mutex_lock(&wav_lock)) { ast_log(LOG_WARNING, "Unable to lock wav list\n"); return -1; } res = glistcnt; - ast_pthread_mutex_unlock(&wav_lock); + ast_mutex_unlock(&wav_lock); return res; } |