{
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);
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);
}
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);
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