From: Boram Park Date: Mon, 25 Apr 2016 14:05:49 +0000 (+0900) Subject: don't call tdm_event_loop_flush in a main thread. X-Git-Tag: accepted/tizen/common/20160427.053804~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=353af27ec5477a66779c8f3c685203a8245a01de;p=platform%2Fcore%2Fuifw%2Flibtdm.git don't call tdm_event_loop_flush in a main thread. All requests and events of a wayland display are handled in a TDM thread. Change-Id: I9469304a631c45a5d71dfcd27c8cc8d78d7be253 --- diff --git a/src/tdm_event_loop.c b/src/tdm_event_loop.c index 1cfaad2..c6d3486 100644 --- a/src/tdm_event_loop.c +++ b/src/tdm_event_loop.c @@ -230,6 +230,12 @@ tdm_event_loop_dispatch(tdm_private_display *private_display) if (tdm_debug_thread) TDM_INFO("dispatch"); + if (tdm_thread_is_running() && + tdm_thread_in_display_thread(syscall(SYS_gettid))) { + TDM_NEVER_GET_HERE(); + return TDM_ERROR_OPERATION_FAILED; + } + /* Don't set timeout to -1. It can make deadblock by two mutex locks. * If need to set -1, use poll() and call tdm_event_loop_dispatch() after * escaping polling. @@ -237,6 +243,8 @@ tdm_event_loop_dispatch(tdm_private_display *private_display) if (wl_event_loop_dispatch(private_loop->wl_loop, 0) < 0) TDM_ERR("dispatch failed"); + wl_display_flush_clients(private_loop->wl_display); + return TDM_ERROR_NONE; } @@ -250,6 +258,12 @@ tdm_event_loop_flush(tdm_private_display *private_display) TDM_RETURN_IF_FAIL(private_loop->wl_display != NULL); + if (tdm_thread_is_running() && + tdm_thread_in_display_thread(syscall(SYS_gettid))) { + TDM_NEVER_GET_HERE(); + return; + } + wl_display_flush_clients(private_loop->wl_display); } diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 53ab893..4dd33e4 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -344,8 +344,6 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) _pthread_mutex_unlock(&private_display->lock); - tdm_event_loop_flush(private_loop->dpy); - return TDM_ERROR_NONE; }