Rename tpl_gsource_send_event to tpl_gsource_send_message. 72/254772/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 6 Jan 2021 06:26:35 +0000 (15:26 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Tue, 9 Mar 2021 08:45:25 +0000 (17:45 +0900)
Change-Id: Ib52508bd46ed588a9ce7893c9dae2d6f61681bfa
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_utils_gthread.c
src/tpl_utils_gthread.h

index f178def9e5ed38884fc9f3eaa70b9f662bb47e40..6329ce918e40c53aed317fb31c196f46b15b75f8 100644 (file)
@@ -126,7 +126,7 @@ tpl_gthread_destroy(tpl_gthread *thread, tpl_gthread_func deinit_func)
 {
        g_mutex_lock(&thread->thread_mutex);
        thread->deinit_func = deinit_func;
-       tpl_gsource_send_event(thread->destroy_sig_source, 1);
+       tpl_gsource_send_message(thread->destroy_sig_source, 1);
        g_cond_wait(&thread->thread_cond, &thread->thread_mutex);
 
        g_main_loop_quit(thread->loop);
@@ -305,7 +305,7 @@ tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread)
                if (source->type == SOURCE_TYPE_NORMAL) {
                        g_mutex_lock(&source->thread->thread_mutex);
 
-                       tpl_gsource_send_event(source->finalizer, 1);
+                       tpl_gsource_send_message(source->finalizer, 1);
 
                        g_cond_wait(&source->thread->thread_cond, &source->thread->thread_mutex);
                        g_mutex_unlock(&source->thread->thread_mutex);
@@ -327,12 +327,18 @@ tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread)
 }
 
 void
-tpl_gsource_send_event(tpl_gsource *source, uint64_t message)
+tpl_gsource_send_message(tpl_gsource *source, uint64_t message)
 {
        uint64_t value = message;
        int ret;
 
-       ret = write(source->event_fd, &value, sizeof(uint64_t));
+       if (!source->is_eventfd) {
+               TPL_ERR("source is not using eventfd. source(%p) fd(%d)",
+                               source, source->fd);
+               return;
+       }
+
+       ret = write(source->fd, &value, sizeof(uint64_t));
        if (ret == -1) {
                TPL_ERR("failed to send devent. tpl_gsource(%p)",
                                source);
index 06d32e620613321811335565a9d2846f43911975..d24ce8e10dca4ef523a461958e0ca2a3358ddc4a 100644 (file)
@@ -97,13 +97,13 @@ void
 tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread);
 
 /**
- * Send an event to dispatch the gsource attached to the thread.
+ * Send an message to dispatch the gsource attached to the thread.
  *
- * @param source Pointer to tpl_gsource to send event.
+ * @param source Pointer to tpl_gsource to send message.
  * @param message Value to be read in thread..
  */
 void
-tpl_gsource_send_event(tpl_gsource *source, uint64_t message);
+tpl_gsource_send_message(tpl_gsource *source, uint64_t message);
 
 /**
  * Get user data from passed tpl_gsource