[asterisk-commits] russell: branch russell/chan_console r49038 -
/team/russell/chan_console/chan...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 28 15:02:16 MST 2006
Author: russell
Date: Thu Dec 28 16:02:15 2006
New Revision: 49038
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49038
Log:
I think I finally have made this not deadlock ... even though it still makes
me feel dirty.
Modified:
team/russell/chan_console/channels/chan_console.c
Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=49038&r1=49037&r2=49038
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Thu Dec 28 16:02:15 2006
@@ -203,15 +203,18 @@
ast_verbose(" -=- Hangup on Console -=-\n");
- while (pvt.incallback) /* :( */
+ pvt.hookstate = 0;
+
+ while (pvt.incallback) { /* :( */
+ ast_mutex_lock(&console_lock);
+ ast_cond_signal(&pvt.cond);
+ ast_mutex_unlock(&console_lock);
usleep(10);
-
- ast_mutex_lock(&console_lock);
+ }
+
c->tech_pvt = NULL;
pvt.owner = NULL;
- if (pvt.hookstate)
- stop_stream();
- ast_mutex_unlock(&console_lock);
+ stop_stream();
return res;
}
@@ -564,12 +567,11 @@
*/
static int stop_stream(void)
{
- if (pvt.hookstate) {
- Pa_AbortStream(pvt.stream);
- Pa_CloseStream(pvt.stream);
- pvt.hookstate = 0;
- ast_cond_signal(&pvt.cond);
- }
+ ast_mutex_lock(&console_lock);
+ Pa_AbortStream(pvt.stream);
+ Pa_CloseStream(pvt.stream);
+ ast_cond_signal(&pvt.cond);
+ ast_mutex_unlock(&console_lock);
return 0;
}
@@ -600,9 +602,8 @@
static int unload_module(void)
{
- ast_mutex_lock(&console_lock);
- stop_stream();
- ast_mutex_unlock(&console_lock);
+ if (pvt.hookstate)
+ stop_stream();
Pa_Terminate();
ast_channel_unregister(&console_tech);
More information about the asterisk-commits
mailing list