simplify switch_core_service_session to protect against a race condition

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10136 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2008-10-23 23:48:11 +00:00
1 parent e520638b92
commit 42dd42ebb6
7 files changed
+42 -52

No files matched your search

+2 -3
View File
@@ -169,7 +169,6 @@ SWITCH_STANDARD_APP(rss_function)
char *timer_name = NULL;
switch_speech_handle_t sh;
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
switch_core_thread_session_t thread_session;
switch_timer_t timer = { 0 }, *timerp = NULL;
uint32_t last;
char *mydata = NULL;
@@ -293,7 +292,7 @@ SWITCH_STANDARD_APP(rss_function)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", (rate / 50) * 2, interval);
/* start a thread to absorb incoming audio */
switch_core_service_session(session, &thread_session, 0);
switch_core_service_session(session);
timerp = &timer;
}
@@ -615,7 +614,7 @@ SWITCH_STANDARD_APP(rss_function)
if (timerp) {
/* End the audio absorbing thread */
switch_core_thread_session_end(&thread_session);
switch_core_thread_session_end(session);
switch_core_timer_destroy(&timer);
}