Use mutex for focus index only when it is not for session in mm_sound_client_set_focu... 91/146491/3 accepted/tizen/unified/20170901.201019 submit/tizen/20170901.030803
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 29 Aug 2017 04:56:00 +0000 (13:56 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 31 Aug 2017 03:11:02 +0000 (12:11 +0900)
Since the muse server which uses this library for multiple handles executes requests from clients serially,
we can skip locking/unlocking the mutex for this case.

[Version] 0.11.21
[Issue Type] Enhancement

Change-Id: Ib90eb2c5f20086c048c7cae52ee9e4037cab265b
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
mm_sound_client.c
packaging/libmm-sound.spec

index 3ca034b..4ba6246 100644 (file)
@@ -1927,7 +1927,11 @@ int mm_sound_client_set_focus_reacquisition(int id, bool reacquisition, bool is_
        bool result;
 
        debug_fenter();
-       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_index_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       /* Since the muse server which uses this library for multiple handles executes requests from clients serially,
+        * we can skip locking/unlocking the mutex for this case. */
+       if (!is_for_session)
+               MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_index_mutex, MM_ERROR_SOUND_INTERNAL);
 
        index = _focus_find_index_by_handle(id);
        if (index == -1) {
@@ -1957,7 +1961,8 @@ int mm_sound_client_set_focus_reacquisition(int id, bool reacquisition, bool is_
        debug_msg("set focus reacquisition(%d) for id(%d)", reacquisition, id);
 
 cleanup:
-       MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
+       if (!is_for_session)
+               MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
        debug_fleave();
        return ret;
 }
index d3f7345..afbae0c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.11.20
+Version:    0.11.21
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0