tpl_wayland_egl_thread: Added timeout source for test. 14/134814/5
authorjoonbum.ko <joonbum.ko@samsung.com>
Fri, 21 Apr 2017 00:45:56 +0000 (09:45 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Wed, 21 Jun 2017 07:04:25 +0000 (16:04 +0900)
Change-Id: Ib2ee280a2a1ef97117d37c123450e79e64bae6df
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 2a09187..ba512b2 100644 (file)
@@ -492,6 +492,33 @@ static const struct wl_registry_listener registry_listener = {
        reg_global_remove
 };
 
+static gboolean
+timeout_cb(gpointer data)
+{
+       static int count = 0;
+       TPL_DEBUG("TIMEOUT count:%d", ++count);
+       return TRUE;
+}
+
+static GSource*
+_twe_thread_test_add_timeout(twe_thread *thread, struct wl_display *display)
+{
+       GSource *timeout;
+       timeout = g_timeout_source_new(1000);
+       g_source_set_callback(timeout, timeout_cb, display, NULL);
+       g_source_attach(timeout, g_main_loop_get_context(thread->ctx->twe_loop));
+       g_source_unref(timeout);
+
+       return timeout;
+}
+
+static void
+_twe_thread_test_del_timeout(GSource *timeout)
+{
+       g_source_destroy(timeout);
+       g_source_unref(timeout);
+}
+
 void
 main(void)
 {
@@ -499,6 +526,7 @@ main(void)
        struct wl_registry *registry;
        struct wl_event_queue *ev_queue;
        int count = 0;
+       GSource *timeout;
 
        twe_thread *t_thread = NULL;
 
@@ -529,6 +557,7 @@ main(void)
                }
        }
 
+       _twe_thread_test_del_timeout(timeout);
        twe_thread_destroy(t_thread);
 }