int pid;
int thread_state;
+ bool *is_stop_request_done;
} tone_info_t;
typedef enum {
debug_enter("(handle %p)", handle);
+ /* if the stop is request done ptr is valid, then inform the result */
+ if (toneInfo->is_stop_request_done)
+ *(toneInfo->is_stop_request_done) = true;
+
pthread_mutex_destroy(&toneInfo->mutex);
if (toneInfo)
free(toneInfo);
int MMSoundPlugCodecToneStop(MMHandleType handle)
{
tone_info_t *toneInfo = (tone_info_t*) handle;
+ bool is_stop_request_done = false;
debug_enter("(handle %p)", handle);
pthread_mutex_lock(&toneInfo->mutex);
debug_msg("state(%d) is already STOP or NONE. return", toneInfo->state);
return MM_ERROR_NONE;
}
+ toneInfo->is_stop_request_done = &is_stop_request_done;
toneInfo->state = STATE_STOP;
toneInfo->thread_state = THREAD_STATE_STOP;
pthread_mutex_unlock(&toneInfo->mutex);
debug_msg("sent stop signal");
- while (toneInfo->state != STATE_NONE)
+ /* check whether stop is actually finished */
+ while (is_stop_request_done == false)
usleep(30000);
debug_leave();