]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't destroy a mutex we are still using
authorMichael Jerris <mike@jerris.com>
Mon, 29 Oct 2007 22:15:42 +0000 (22:15 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 29 Oct 2007 22:15:42 +0000 (22:15 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@314 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/zap_io.c

index 951f7424d7e9e661b35c1d2fe2991d756bfb0fb6..fe0c0a6d07a7b0db20f45b86674fc528d92768f8 100644 (file)
@@ -323,10 +323,6 @@ zap_status_t zap_span_close_all(void)
                        zap_channel_destroy(&span->channels[i]);
                }
 
-               if (span->mutex) {
-                       zap_mutex_destroy(&span->mutex);
-               }
-
                zap_safe_free(span->signal_data);
        }
        zap_mutex_unlock(globals.mutex);
@@ -1945,6 +1941,7 @@ zap_status_t zap_global_destroy(void)
 
                if (zap_test_flag(cur_span, ZAP_SPAN_CONFIGURED)) {
                        zap_mutex_lock(cur_span->mutex);
+                       zap_clear_flag(cur_span, ZAP_SPAN_CONFIGURED);
                        for(j = 1; j <= cur_span->chan_count; j++) {
                                zap_channel_t *cur_chan = &cur_span->channels[j];
                                if (zap_test_flag(cur_chan, ZAP_CHANNEL_CONFIGURED)) {
@@ -1952,6 +1949,10 @@ zap_status_t zap_global_destroy(void)
                                }
                        }
                        zap_mutex_unlock(cur_span->mutex);
+
+                       if (cur_span->mutex) {
+                               zap_mutex_destroy(&cur_span->mutex);
+                       }
                }
        }