[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r784 - /team/mnicholson/ch...
SVN commits to the Asterisk addons project
asterisk-addons-commits at lists.digium.com
Thu Feb 19 15:53:45 CST 2009
Author: mnicholson
Date: Thu Feb 19 15:53:45 2009
New Revision: 784
URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=784
Log:
Added better cleanup of devices when unloading the module.
Modified:
team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=784&r1=783&r2=784
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Thu Feb 19 15:53:45 2009
@@ -2371,7 +2371,7 @@
pvt->state = MBL_STATE_PREIDLE;
}
- for (;;) {
+ while (!check_unloading()) {
if (pvt->state == MBL_STATE_DIAL1)
t = pvt->dial_timeout * 1000;
@@ -2746,7 +2746,6 @@
pvt->sco_socket = -1;
pvt->connected = 0;
- pvt->monitor_thread = AST_PTHREADT_NULL;
ast_verb(3, "Bluetooth Device %s has disconnected.\n", pvt->id);
manager_event(EVENT_FLAG_SYSTEM, "MobileStatus", "Status: Disconnect\r\nDevice: %s\r\n", pvt->id);
@@ -2767,7 +2766,7 @@
pvt->state = MBL_STATE_PREIDLE;
- for (;;) {
+ while (!check_unloading()) {
if (pvt->state == MBL_STATE_RING2)
t = 2000;
@@ -2845,7 +2844,6 @@
close(pvt->sco_socket);
pvt->sco_socket = -1;
pvt->connected = 0;
- pvt->monitor_thread = AST_PTHREADT_NULL;
manager_event(EVENT_FLAG_SYSTEM, "MobileStatus", "Status: Disconnect\r\nDevice: %s\r\n", pvt->id);
ast_verb(3, "Bluetooth Device %s has disconnected\n", pvt->id);
@@ -3298,7 +3296,7 @@
AST_RWLIST_WRLOCK(&devices);
while ((pvt = AST_RWLIST_REMOVE_HEAD(&devices, entry))) {
if (pvt->monitor_thread != AST_PTHREADT_NULL) {
- pthread_cancel(pvt->monitor_thread);
+ pthread_kill(pvt->monitor_thread, SIGURG);
pthread_join(pvt->monitor_thread, NULL);
}
More information about the asterisk-addons-commits
mailing list