tpl_wayland_egl_thread: Fixed to send signal when tdm_source already detroyed. 54/194254/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Fri, 30 Nov 2018 04:52:23 +0000 (13:52 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 30 Nov 2018 04:52:27 +0000 (13:52 +0900)
 - If there was an error when processing tdm_client_handle_events(),
  tdm_source would have been destroyed before the process terminated.
 - In this case, when Main thread terminate its twe_thread,
  main thread will have to wait for the tdm_source destroy signal.

Change-Id: If2a8afb8dc801e5313e33298d9b320d4976e1480
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 87c54a7094275301a18ed79ddc19508db0f24220..56e28bd5b4d55d4024fbe2c609472e699b5ab0be 100644 (file)
@@ -448,13 +448,15 @@ _twe_thread_tdm_source_destroy(void *source)
 {
        twe_tdm_source *tdm_source = (twe_tdm_source *)source;
 
+       g_mutex_lock(&_twe_ctx->thread_mutex);
+
        if (!tdm_source || g_source_is_destroyed(&tdm_source->gsource)) {
                TPL_ERR("TDM source(%p) already destroyed.", tdm_source);
+               g_cond_signal(&_twe_ctx->thread_cond);
+               g_mutex_unlock(&_twe_ctx->thread_mutex);
                return;
        }
 
-       g_mutex_lock(&_twe_ctx->thread_mutex);
-
        g_source_remove_unix_fd(&tdm_source->gsource, tdm_source->tag);
        g_source_destroy(&tdm_source->gsource);
        g_source_unref(&tdm_source->gsource);