diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-22 17:42:14 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-22 17:42:14 +0000 |
commit | ae5c80e1deeae11fa0f3478a6efa03e38971897f (patch) | |
tree | a3a0875ae4e73c9d9a1fc67f56ffa1ce73fe5457 /channels/chan_vpb.c | |
parent | 8f813d432c685f0b0c25e98261379b083263cf32 (diff) |
Merge major BSD mutex and symbol conflict patches (bug #1816) (link patch still pending)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3273 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_vpb.c')
-rwxr-xr-x | channels/chan_vpb.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c index 7528a0f20..8344ccba3 100755 --- a/channels/chan_vpb.c +++ b/channels/chan_vpb.c @@ -279,8 +279,6 @@ static int vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, bridges[i].fo = fo; bridges[i].c0 = c0; bridges[i].c1 = c1; - ast_mutex_init(&bridges[i].lock); - pthread_cond_init(&bridges[i].cond, NULL); } } ast_mutex_unlock(&bridge_lock); @@ -356,8 +354,6 @@ static int vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, ast_mutex_lock(&bridge_lock); { bridges[i].inuse = 0; - ast_mutex_destroy(&bridges[i].lock); - pthread_cond_destroy(&bridges[i].cond); } ast_mutex_unlock(&bridge_lock); p0->bridge = NULL; @@ -975,8 +971,13 @@ static void mkbrd(vpb_model_t model, int echo_cancel) bridges = (vpb_bridge_t *)malloc(max_bridges * sizeof(vpb_bridge_t) ); if(!bridges) ast_log(LOG_ERROR, "Failed to initialize bridges\n"); - else + else { memset(bridges,0,max_bridges * sizeof(vpb_bridge_t)); + for(int i = 0; i < max_bridges; i++ ) { + ast_mutex_init(&bridges[i].lock); + pthread_cond_init(&bridges[i].cond, NULL); + } + } } if(!echo_cancel) { if (model==vpb_model_v4pci) { @@ -1062,6 +1063,7 @@ struct vpb_pvt *mkif(int board, int channel, int mode, float txgain, float rxgai tmp->vpb_model = vpb_model_v4pci; } + ast_mutex_init(&tmp->owner_lock); ast_mutex_init(&tmp->lock); ast_mutex_init(&tmp->record_lock); ast_mutex_init(&tmp->play_lock); @@ -2080,6 +2082,7 @@ int unload_module() p = iflist; ast_mutex_destroy(&p->lock); pthread_cancel(p->readthread); + ast_mutex_destroy(&p->owner_lock); ast_mutex_destroy(&p->record_lock); ast_mutex_destroy(&p->play_lock); ast_mutex_destroy(&p->play_dtmf_lock); @@ -2098,6 +2101,10 @@ int unload_module() memset(bridges, 0, sizeof bridges); } ast_mutex_unlock(&bridge_lock); ast_mutex_destroy(&bridge_lock); + for(int i = 0; i < max_bridges; i++ ) { + ast_mutex_destroy(&bridges[i].lock); + pthread_cond_destroy(&bridges[i].cond, NULL); + } free(bridges); return 0; |