X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=focus_server%2Fmm_sound_mgr_focus_socket.c;h=beaaa6799705ad864a87e89d97086b62c62e87a3;hb=4f5c0721cc88d7bec7876f67e3f122e96d60433f;hp=162c552f823fab4834571cd16bcfe3e6d5aa3978;hpb=8e8b2c303fd4d0556b535c9069e8ff1b1dc3bbc0;p=platform%2Fcore%2Fmultimedia%2Flibmm-sound.git diff --git a/focus_server/mm_sound_mgr_focus_socket.c b/focus_server/mm_sound_mgr_focus_socket.c index 162c552..beaaa67 100644 --- a/focus_server/mm_sound_mgr_focus_socket.c +++ b/focus_server/mm_sound_mgr_focus_socket.c @@ -63,6 +63,7 @@ enum { }; #define DEFAULT_FOCUS_THREAD_READY_TIMEOUT 5 +#define MAX_FOCUS_THREAD_READY_WAIT_RETRY 6 typedef struct mm_sound_focus_thread_data { const int *sockfd; @@ -560,8 +561,8 @@ void MMSoundMgrFocusSocketFini(int *sockfd) int MMSoundMgrFocusSocketReadyToWork(const int *sockfd) { - debug_enter(); focus_thread_data_t *thread_data = NULL; + int retry_remaining = MAX_FOCUS_THREAD_READY_WAIT_RETRY; if (*sockfd < 0) { debug_error("input param sockfd [%d] is not valid", *sockfd); @@ -577,14 +578,15 @@ int MMSoundMgrFocusSocketReadyToWork(const int *sockfd) goto ERROR_INTERNAL; } - if (!__focus_thread_ready_wait(thread_data, DEFAULT_FOCUS_THREAD_READY_TIMEOUT)) { - debug_error("focus thread is not ready for %u sec!!!", DEFAULT_FOCUS_THREAD_READY_TIMEOUT); - goto ERROR_INTERNAL; - } - - debug_leave(); + do { + if (__focus_thread_ready_wait(thread_data, DEFAULT_FOCUS_THREAD_READY_TIMEOUT)) { + debug_msg("[%d] wait success!!", retry_remaining); + return MM_ERROR_NONE; + } - return MM_ERROR_NONE; + debug_error("[%d] focus thread is not ready for %u sec!!!", + retry_remaining, DEFAULT_FOCUS_THREAD_READY_TIMEOUT); + } while (--retry_remaining > 0); ERROR_INTERNAL: __focus_thread_data_destroy(thread_data);