tpl_wayland_egl_thread: Added assert case to detect abnomalies. 39/196339/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 27 Dec 2018 07:59:18 +0000 (16:59 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 27 Dec 2018 07:59:21 +0000 (16:59 +0900)
 - In the twe thread, the event fd being poll must be
  woken up only with G_IO_IN.
 - However, if some problem occurs in fd, it can wake up with
  G_IO_ERR, G_IO_HUP, G_IO_NVAL, and try dispatch.
   In this case, it is difficult to predict the situation after G_SOURCE_REMOVE,
  so ASSERT should be used to find the time when the problem occurs.
 - If there is no ASSERT () or remove, g_main_loop will repeatedly
  wake up and try to dispatch the source, causing a problem of making CPU usage high.

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

index 6cdbbd22b881a5c0b07abe62bc2e27e4333a3f7c..ce5f854482a7bc808d6e2529d1a6b793b0a2261c 100644 (file)
@@ -258,6 +258,10 @@ _twe_thread_del_source_dispatch(GSource *source, GSourceFunc cb, gpointer data)
 
                if (del_source->destroy_target_source_func)
                        del_source->destroy_target_source_func(del_source->target_source);
+       } else {
+               TPL_ERR("eventfd(%d) cannot wake up with other condition. cond(%d)",
+                               del_source->event_fd, cond);
+               TPL_ASSERT((cond & G_IO_IN));
        }
 
        return G_SOURCE_CONTINUE;
@@ -2040,6 +2044,10 @@ _twe_thread_wl_surface_dispatch(GSource *source, GSourceFunc cb, gpointer data)
                } else {
                        _twe_thread_wl_surface_acquire_and_commit(surf_source);
                }
+       } else {
+               TPL_ERR("eventfd(%d) cannot wake up with other condition. cond(%d)",
+                               surf_source->event_fd, cond);
+               TPL_ASSERT((cond & G_IO_IN));
        }
 
        return G_SOURCE_CONTINUE;