From 1077efadd285a710bef44551fed5c00395336b22 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Mon, 14 May 2018 15:12:41 +0900 Subject: [PATCH] thread: Do not send a value of sync as '1' to display thread (quick-fix) Sync type event from display-thread(main thread) can't be handled. In this way, if we call tdm_thread_send_cb() with 'cb_base->sync = 1', then libtdm will eveventually raise abort(). Please see commit '4abfab36' for more detail. Change-Id: Ia588141fc9e752753dbe04fda835c5532839d95e --- src/tdm_thread.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 997d772..2cc2f13 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -708,7 +708,12 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa if (!handler_in_other_thread) { if (keep_private_thread) { - if (cb_base->sync && waiting_tid != 0) { + /* NOTE quick fix + * In case of 'cb_base->sync = 0' and 'waiting_tid != 0', + * probably it means one thread is waiting for signal of + * pthread condition. + */ + if (!cb_base->sync && waiting_tid != 0) { waiting_tid = 0; pthread_cond_signal(&keep_private_thread->event_cond); if (tdm_debug_module & TDM_DEBUG_THREAD) @@ -726,11 +731,23 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa */ assert(keep_private_thread != NULL); - ret = tdm_thread_send_cb(private_display->private_loop, cb_base); - TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); - + if (!cb_base->sync) { + ret = tdm_thread_send_cb(private_display->private_loop, cb_base); + TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); + } /* waiting until all cb are done in another thread */ - if (cb_base->sync) { + else { + /* NOTE quick fix + * Sync type event from display-thread(main thread) can't be + * handled. In this way, if we call tdm_thread_send_cb() with + * 'cb_base->sync = 1', then libtdm will eveventually raise + * abort(). Please see commit '4abfab36' for more detail. + */ + cb_base->sync = 0; + ret = tdm_thread_send_cb(private_display->private_loop, cb_base); + TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); + cb_base->sync = 1; + /* if waiting_tid is not 0, it means there are two sync-type events at the same time. * and it would make deadlock issue. */ -- 2.7.4