From: Joonbum Ko Date: Mon, 9 Nov 2020 05:19:52 +0000 (+0900) Subject: Added an API to check io condtion. X-Git-Tag: submit/tizen/20210316.021228~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bcd751a968af21b5b068a2a63cac25359081e71;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Added an API to check io condtion. Change-Id: I493b57bd93096fe433cd6db521563cacd8d47a3c Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_utils_gthread.c b/src/tpl_utils_gthread.c index 181bf31..66e7b23 100644 --- a/src/tpl_utils_gthread.c +++ b/src/tpl_utils_gthread.c @@ -285,6 +285,23 @@ tpl_gsource_get_data(tpl_gsource *source) return source->data; } +tpl_bool_t +tpl_gsource_check_io_condition(tpl_gsource *source) +{ + GIOCondition cond; + + if (!source) { + TPL_ERR("Invalid parameter tpl_gsource is null"); + return TPL_FALSE; + } + + cond = g_source_query_unix_fd(source->gsource, source->tag); + if (cond & G_IO_IN) + return TPL_TRUE; + + return TPL_FALSE; +} + void tpl_gmutex_init(tpl_gmutex *gmutex) { diff --git a/src/tpl_utils_gthread.h b/src/tpl_utils_gthread.h index 1886609..084754c 100644 --- a/src/tpl_utils_gthread.h +++ b/src/tpl_utils_gthread.h @@ -105,6 +105,15 @@ tpl_gsource_send_event(tpl_gsource *source, uint64_t message); void * tpl_gsource_get_data(tpl_gsource *source); +/** + * Check the GIOCondition of fd that tpl_gsource has + * + * @param source Pointer to tpl_gsource to check io condition. + * @return TPL_TRUE if GIOCondition is G_IO_IN, TPL_FALSE otherwise (G_IO_ERR). + */ +tpl_bool_t +tpl_gsource_check_io_condition(tpl_gsource *source); + /** * wrapping g_mutex_init() *