[Freeswitch-svn] [commit] r2302 - freeswitch/trunk/src/mod/applications/mod_conference
Freeswitch SVN
anthm at freeswitch.org
Tue Aug 15 18:19:39 EDT 2006
Author: anthm
Date: Tue Aug 15 18:19:38 2006
New Revision: 2302
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
add proper shutdown to mod_conference
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Tue Aug 15 18:19:38 2006
@@ -53,6 +53,8 @@
switch_mutex_t *id_mutex;
switch_mutex_t *hash_mutex;
uint32_t id_pool;
+ int32_t running;
+ uint32_t threads;
} globals;
struct conference_member;
@@ -451,7 +453,9 @@
return NULL;
}
- while(!switch_test_flag(conference, CFLAG_DESTRUCT)) {
+ globals.threads++;
+
+ while(globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
uint8_t file_frame[CONF_BUFFER_SIZE] = {0};
switch_size_t file_sample_len = samples;
switch_size_t file_data_len = samples * 2;
@@ -654,7 +658,8 @@
switch_core_destroy_memory_pool(&pool);
}
}
-
+
+ globals.threads--;
return NULL;
}
@@ -2908,6 +2913,22 @@
/* Release the config registry handle */
switch_xml_free(cxml);
+ globals.running = 1;
/* indicate that the module should continue to be loaded */
return status;
+}
+
+
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
+{
+
+
+ if (globals.running) {
+ globals.running = 0;
+ while (globals.threads) {
+ switch_yield(100000);
+ }
+ }
+
+ return SWITCH_STATUS_SUCCESS;
}
More information about the Freeswitch-svn
mailing list