]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
slight fix on last commit
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 17 Sep 2010 19:49:43 +0000 (14:49 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 17 Sep 2010 19:49:43 +0000 (14:49 -0500)
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/switch_core_sqldb.c

index 51e843778be9393ef333c366239dd1e5e37ddae5..2ea3eb00a37149e3237c6fddfe1cb0b6aa198b35 100644 (file)
@@ -122,8 +122,13 @@ static struct {
 
 
 
-static void wake_thread(void)
+static void wake_thread(int force)
 {
+       if (force) {
+        switch_thread_cond_signal(globals.cond);
+               return;
+       }
+
        if (switch_mutex_trylock(globals.cond_mutex) == SWITCH_STATUS_SUCCESS) {
                switch_thread_cond_signal(globals.cond);
                switch_mutex_unlock(globals.cond_mutex);
@@ -140,7 +145,7 @@ static int add_pvt(pvt_t *pvt)
         t38_state_list.head = pvt;
         switch_mutex_unlock(t38_state_list.mutex);
         r = 1;
-        wake_thread();
+        wake_thread(0);
     } else {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n");
     }
@@ -175,7 +180,7 @@ static int del_pvt(pvt_t *del_pvt)
 
     switch_mutex_unlock(t38_state_list.mutex);
 
-    wake_thread();
+    wake_thread(0);
 
     return r;
 }
@@ -1345,7 +1350,7 @@ void mod_spandsp_fax_shutdown(void)
     switch_status_t tstatus = SWITCH_STATUS_SUCCESS;
 
     t38_state_list.thread_running = 0;
-    wake_thread();
+    wake_thread(1);
     switch_thread_join(&tstatus, t38_state_list.thread);
        memset(&globals, 0, sizeof(globals));
 }
index 4c742f342f1405a2a799acb9fb58d81887d47987..a5322751cdb3b9c9130e6e3bbe452ab178e5a4db 100644 (file)
@@ -464,8 +464,13 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t
        return status;
 }
 
-static void wake_thread(void)
+static void wake_thread(int force)
 {
+       if (force) {
+               switch_thread_cond_signal(sql_manager.cond);
+               return;
+       }
+
        if (switch_mutex_trylock(sql_manager.cond_mutex) == SWITCH_STATUS_SUCCESS) {
                switch_thread_cond_signal(sql_manager.cond);
                switch_mutex_unlock(sql_manager.cond_mutex);
@@ -1407,7 +1412,7 @@ static void core_event_handler(switch_event_t *event)
                                switch_queue_push(sql_manager.sql_queue[0], sql[i]);
                        }
                        sql[i] = NULL;
-                       wake_thread();
+                       wake_thread(0);
                }
        }
 }
@@ -1681,7 +1686,7 @@ void switch_core_sqldb_stop(void)
                        switch_queue_push(sql_manager.sql_queue[0], NULL);
                        switch_queue_push(sql_manager.sql_queue[1], NULL);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n");
-                       wake_thread();
+                       wake_thread(1);
                }
 
                sql_manager.thread_running = -1;