fix shutdown race
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@395 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
6a9cbad9af
commit
4cb323b5ac
|
@ -218,7 +218,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
|
||||||
|
|
||||||
assert(interval != 0);
|
assert(interval != 0);
|
||||||
|
|
||||||
while (zap_test_flag(zchan, ZAP_CHANNEL_INTHREAD)) {
|
while (zap_running() && zap_test_flag(zchan, ZAP_CHANNEL_INTHREAD)) {
|
||||||
zap_wait_flag_t flags = ZAP_READ;
|
zap_wait_flag_t flags = ZAP_READ;
|
||||||
zap_size_t dlen = 0;
|
zap_size_t dlen = 0;
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,11 @@ static zap_status_t zap_channel_destroy(zap_channel_t *zchan)
|
||||||
|
|
||||||
if (zap_test_flag(zchan, ZAP_CHANNEL_CONFIGURED)) {
|
if (zap_test_flag(zchan, ZAP_CHANNEL_CONFIGURED)) {
|
||||||
|
|
||||||
|
while (zap_test_flag(zchan, ZAP_CHANNEL_INTHREAD)) {
|
||||||
|
zap_log(ZAP_LOG_INFO, "Waiting for thread to exit on channel %u:%u\n", zchan->span_id, zchan->chan_id);
|
||||||
|
zap_sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
zap_buffer_destroy(&zchan->digit_buffer);
|
zap_buffer_destroy(&zchan->digit_buffer);
|
||||||
zap_buffer_destroy(&zchan->dtmf_buffer);
|
zap_buffer_destroy(&zchan->dtmf_buffer);
|
||||||
zap_buffer_destroy(&zchan->fsk_buffer);
|
zap_buffer_destroy(&zchan->fsk_buffer);
|
||||||
|
@ -1994,8 +1999,8 @@ zap_status_t zap_global_destroy(void)
|
||||||
unsigned int i,j;
|
unsigned int i,j;
|
||||||
time_end();
|
time_end();
|
||||||
|
|
||||||
zap_span_close_all();
|
|
||||||
globals.running = 0;
|
globals.running = 0;
|
||||||
|
zap_span_close_all();
|
||||||
zap_sleep(1000);
|
zap_sleep(1000);
|
||||||
|
|
||||||
for(i = 1; i <= globals.span_index; i++) {
|
for(i = 1; i <= globals.span_index; i++) {
|
||||||
|
|
Loading…
Reference in New Issue