change switch_core_timer_next to return switch_status_t, update all users to new usage, add some error checking to mod_conference so that it bails out of the loops more gracefully on shutdown.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4454 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-03-05 23:18:29 +00:00
parent 8f0b94435c
commit ec3fcde87d
6 changed files with 16 additions and 11 deletions

View File

@ -931,7 +931,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, ch
\param timer the timer to wait on
\return the newest sample count
*/
SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer);
SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer);
/*!
\brief Step the timer one step

View File

@ -676,7 +676,10 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
switch_size_t file_data_len = samples * 2;
/* Sync the conference to a single timing source */
switch_core_timer_next(&timer);
if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
switch_set_flag(conference, CFLAG_DESTRUCT);
break;
}
switch_mutex_lock(conference->mutex);
ready = 0;
@ -1659,7 +1662,9 @@ static void conference_loop_output(conference_member_t *member)
}
}
switch_core_timer_next(&timer);
if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
break;
}
} /* Rinse ... Repeat */

View File

@ -623,7 +623,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
{
switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
if (switch_core_timer_next(&tech_pvt->timer) < 0) {
if (switch_core_timer_next(&tech_pvt->timer) != SWITCH_STATUS_SUCCESS) {
switch_core_file_close(&tech_pvt->fh);
switch_core_codec_destroy(&tech_pvt->write_codec);
goto cng;

View File

@ -273,7 +273,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
}
if (tto->timer) {
if (switch_core_timer_next(tto->timer)< 0) {
if (switch_core_timer_next(tto->timer) != SWITCH_STATUS_SUCCESS) {
break;
}

View File

@ -1315,7 +1315,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, ch
}
SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer)
SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer)
{
if (!timer->timer_interface) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not initilized!\n");
@ -1323,9 +1323,9 @@ SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer)
}
if (timer->timer_interface->timer_next(timer) == SWITCH_STATUS_SUCCESS) {
return timer->samplecount;
return SWITCH_STATUS_SUCCESS;
} else {
return -1;
return SWITCH_STATUS_GENERR;
}
}

View File

@ -1444,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (timer_name) {
if (switch_core_timer_next(&timer) < 0) {
if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
break;
}
} else { /* time off the channel (if you must) */
@ -1750,7 +1750,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_PAUSE)) {
if (timer) {
if ((x = switch_core_timer_next(timer)) < 0) {
if (switch_core_timer_next(timer) != SWITCH_STATUS_SUCCESS) {
break;
}
} else {
@ -1813,7 +1813,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
}
if (timer) {
if ((x = switch_core_timer_next(timer)) < 0) {
if (switch_core_timer_next(timer) != SWITCH_STATUS_SUCCESS) {
break;
}
} else { /* time off the channel (if you must) */