[0.6.230] Use FIFO ticket lock when use command lock
[platform/core/multimedia/libmm-player.git] / src / mm_player.c
index 52feafe..56d3fae 100644 (file)
@@ -54,7 +54,7 @@ int mm_player_create(MMHandleType *player)
        }
 
        /* create player lock and cond */
-       g_mutex_init(&new_player->cmd_lock);
+       MMPLAYER_CMD_LOCK_INIT(new_player);
        g_mutex_init(&new_player->reconfigure_lock);
        g_cond_init(&new_player->reconfigure_cond);
 
@@ -86,7 +86,7 @@ ERROR:
 
        if (new_player) {
                _mmplayer_destroy((MMHandleType)new_player);
-               g_mutex_clear(&new_player->cmd_lock);
+               MMPLAYER_CMD_LOCK_DEINIT(new_player);
                g_mutex_clear(&new_player->reconfigure_lock);
                g_cond_clear(&new_player->reconfigure_cond);
                MMPLAYER_FREEIF(new_player);
@@ -113,7 +113,10 @@ int mm_player_destroy(MMHandleType player)
 
        MMPLAYER_CMD_UNLOCK(player);
 
-       g_mutex_clear(&((mmplayer_t *)player)->cmd_lock);
+       MMPLAYER_CMD_LOCK(player);
+       MMPLAYER_CMD_UNLOCK(player);
+
+       MMPLAYER_CMD_LOCK_DEINIT(player);
        g_mutex_clear(&((mmplayer_t *)player)->reconfigure_lock);
        g_cond_clear(&((mmplayer_t *)player)->reconfigure_cond);