mutex: don't use the tdm macros for gLock variable. 19/114819/1
authorBoram Park <boram1288.park@samsung.com>
Wed, 15 Feb 2017 07:29:05 +0000 (16:29 +0900)
committerBoram Park <boram1288.park@samsung.com>
Wed, 15 Feb 2017 07:32:26 +0000 (16:32 +0900)
When _pthread_mutex_unlock macro, tdm_mutex_locked becomes 0. Then, TDM_MUTEX_IS_LOCKED
return 0 even though display->lock is locked. TDM_MUTEX_IS_LOCKED actually is for
display->lock.

Change-Id: Idd4f638b84c0d244de61404e08ee4dfcf81921a2

src/tdm.c

index 242910a..9baace2 100644 (file)
--- a/src/tdm.c
+++ b/src/tdm.c
@@ -891,11 +891,11 @@ tdm_display_init(tdm_error *error)
        tdm_error ret;
        double stamp1, stamp2, start;
 
-       _pthread_mutex_lock(&gLock);
+       pthread_mutex_lock(&gLock);
 
        if (g_private_display) {
                g_private_display->init_count++;
-               _pthread_mutex_unlock(&gLock);
+               pthread_mutex_unlock(&gLock);
                if (error)
                        *error = TDM_ERROR_NONE;
                return g_private_display;
@@ -997,7 +997,7 @@ tdm_display_init(tdm_error *error)
                *error = TDM_ERROR_NONE;
 
        _pthread_mutex_unlock(&private_display->lock);
-       _pthread_mutex_unlock(&gLock);
+       pthread_mutex_unlock(&gLock);
 
        TDM_INFO("init time: %.3f ms", (tdm_helper_get_time() - start) * 1000.0);
 
@@ -1015,7 +1015,7 @@ failed_mutex_init:
 failed_alloc:
        if (error)
                *error = ret;
-       _pthread_mutex_unlock(&gLock);
+       pthread_mutex_unlock(&gLock);
        return NULL;
 }
 
@@ -1027,11 +1027,11 @@ tdm_display_deinit(tdm_display *dpy)
        if (!private_display)
                return;
 
-       _pthread_mutex_lock(&gLock);
+       pthread_mutex_lock(&gLock);
 
        private_display->init_count--;
        if (private_display->init_count > 0) {
-               _pthread_mutex_unlock(&gLock);
+               pthread_mutex_unlock(&gLock);
                return;
        }
 
@@ -1062,7 +1062,7 @@ tdm_display_deinit(tdm_display *dpy)
                tdm_debug_dump_dir = NULL;
        }
 
-       _pthread_mutex_unlock(&gLock);
+       pthread_mutex_unlock(&gLock);
 
        TDM_INFO("done");
 }