Added message argunment to thread dispatch callback. 73/254773/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 6 Jan 2021 06:46:31 +0000 (15:46 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Tue, 9 Mar 2021 08:45:35 +0000 (17:45 +0900)
Change-Id: I37c39032839c0e598006ed29ae31ea5ca1b66207
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_utils_gthread.c
src/tpl_utils_gthread.h
src/tpl_wl_egl.c

index 6329ce9..8bfcb01 100644 (file)
@@ -185,8 +185,19 @@ _thread_source_dispatch(GSource *source, GSourceFunc cb, gpointer data)
        TPL_IGNORE(cb);
 
        if (cond & G_IO_IN) {
+               ssize_t s;
+               uint64_t message = 0;
+
+               if (gsource->is_eventfd) {
+                       s = read(gsource->fd, &message, sizeof(uint64_t));
+                       if (s != sizeof(uint64_t)) {
+                               TPL_ERR("Failed to read from event_fd(%d)",
+                                               gsource->fd);
+                       }
+               }
+
                if (gsource->gsource_funcs && gsource->gsource_funcs->dispatch)
-                       ret = gsource->gsource_funcs->dispatch(gsource);
+                       ret = gsource->gsource_funcs->dispatch(gsource, message);
 
                if (gsource->type == SOURCE_TYPE_FINALIZER) {
                        tpl_gsource *del_source = (tpl_gsource *)data;
index d24ce8e..66ad277 100644 (file)
@@ -30,7 +30,7 @@ typedef enum {
 struct _tpl_gsource_functions {
        tpl_bool_t (*prepare)  (tpl_gsource *source);
        tpl_bool_t (*check)    (tpl_gsource *source);
-       tpl_bool_t (*dispatch) (tpl_gsource *source);
+       tpl_bool_t (*dispatch) (tpl_gsource *source, uint64_t message);
        void       (*finalize) (tpl_gsource *source);
 };
 
index c0e1416..3079519 100644 (file)
@@ -203,11 +203,13 @@ _check_native_handle_is_wl_display(tpl_handle_t display)
 }
 
 static tpl_bool_t
-__thread_func_tdm_dispatch(tpl_gsource *gsource)
+__thread_func_tdm_dispatch(tpl_gsource *gsource, uint64_t message)
 {
        tpl_wl_egl_display_t       *wl_egl_display = NULL;
        tdm_error                   tdm_err = TDM_ERROR_NONE;
 
+       TPL_IGNORE(message);
+
        wl_egl_display = (tpl_wl_egl_display_t *)tpl_gsource_get_data(gsource);
        if (!wl_egl_display) {
                TPL_ERR("Failed to get wl_egl_display from gsource(%p)", gsource);