diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-27 13:57:29 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-27 13:57:29 +0000 |
commit | 7a12871f6741596b0a23e69f1c2f1e15dd30db71 (patch) | |
tree | 17f5fd96de4c03bbcf1ae2b41eb26baf646c40dd /bridges | |
parent | c59cbe4bef68369531dcfe2c2fa3572d57fc103b (diff) |
Fix a potential race condition when creating a software based mixing bridge.
It was possible for no timer to become available between creating the bridge
and starting it. We now open a timer when creating it and keep it open until the
bridge is destroyed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184628 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/bridge_softmix.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index 4f1e4d76f..73ac29660 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -91,7 +91,7 @@ static int softmix_bridge_create(struct ast_bridge *bridge) return -1; } - ast_timer_close(timingfd); + bridge->bridge_pvt = (void*)(unsigned long)timingfd; return 0; } @@ -199,11 +199,7 @@ static int softmix_bridge_poke(struct ast_bridge *bridge, struct ast_bridge_chan /*! \brief Function which acts as the mixing thread */ static int softmix_bridge_thread(struct ast_bridge *bridge) { - int timingfd; - - if ((timingfd = ast_timer_open()) < 0) { - return -1; - } + int timingfd = (unsigned short)(unsigned long)bridge->bridge_pvt; ast_timer_set_rate(timingfd, (1000 / SOFTMIX_INTERVAL)); @@ -267,7 +263,6 @@ static int softmix_bridge_thread(struct ast_bridge *bridge) ao2_lock(bridge); } - ast_timer_set_rate(timingfd, 0); ast_timer_close(timingfd); return 0; |