thread: only allow a sync event from tdm-thread to display-thread 31/174431/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 2 Apr 2018 06:51:42 +0000 (15:51 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 2 Apr 2018 06:51:42 +0000 (15:51 +0900)
A sync-type event from display-thread to tdm-thread can't be handled.
If sync-type events happen in both threads at the same time,
it would make a deadlock issue.

Change-Id: Ic45207a173dfe9413f419506da1a6d36e86d06e3

src/tdm_thread.c

index 6ca28f2..ea891a2 100644 (file)
@@ -640,16 +640,18 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa
 
        assert(find_funcs[cb_base->type] != NULL);
 
+       if (keep_private_thread && keep_private_thread->thread_tid != caller_tid) {
+               /* A sync-type event from display-thread to tdm-thread can't be handled.
+                * If sync-type events happen in both threads at the same time,
+                * it would make a deadlock issue.
+                */
+               assert(cb_base->sync != 1);
+       }
+
        if (tdm_debug_module & TDM_DEBUG_THREAD)
                TDM_INFO("'%s' thread_cb (sync:%d, propagation:%d) ------",
                                 tdm_cb_type_str(cb_base->type), cb_base->sync, propagation);
 
-       /* handling only output-status as sync. below logic can't handle two sync-type events */
-       if (cb_base->type == TDM_THREAD_CB_OUTPUT_STATUS)
-               assert(cb_base->sync == 1);
-       else
-               assert(cb_base->sync == 0);
-
        if (!object) {
                object = find_funcs[cb_base->type](private_display, cb_base->object_stamp);
                if (!object) {