GList *data_queue;
pthread_mutex_t call_mutex; /* not to be interrupted while sending and receiving */
+ int eventfd;
} pims_ipc_s;
static unsigned int ref_cnt;
pthread_mutex_lock(&__gmutex);
handle->epoll_stop_thread = TRUE;
+ if (handle->eventfd != -1)
+ eventfd_write(handle->eventfd, 1);
if (handle->fd != -1)
close(handle->fd);
cb_data = (pims_ipc_cb_s*)g_hash_table_lookup(handle->subscribe_cb_table, data->call_id);
if (cb_data == NULL)
- VERBOSE("unable to find %s", call_id);
+ VERBOSE("unable to find %s", data->call_id);
else
cb_data->callback((pims_ipc_h)handle, data->handle, cb_data->user_data);
pthread_mutex_lock(&__gmutex);
+ handle->eventfd = eventfd(0, EFD_NONBLOCK);
+ ev.data.fd = handle->eventfd;
+ ev.events = EPOLLIN;
+ ret = epoll_ctl(epfd, EPOLL_CTL_ADD, handle->eventfd, &ev);
+ WARN_IF(ret != 0, "listen error :%d", ret);
+
ev.events = EPOLLIN | EPOLLHUP;
ev.data.fd = handle->fd;
-
ret = epoll_ctl(epfd, EPOLL_CTL_ADD, handle->fd, &ev);
WARN_IF(ret != 0, "listen error :%d", ret);
pthread_mutex_unlock(&__gmutex);
pthread_mutex_lock(&__gmutex);
if (handle->epoll_stop_thread) {
+ DBG("__io_thread epoll_stop_thread");
pthread_mutex_unlock(&__gmutex);
break;
}
}
close(epfd);
+ close(handle->eventfd);
pthread_exit(NULL);
}
handle->subscribe_fd = -1;
handle->io_thread = 0;
+ handle->eventfd = -1;
handle->service = g_strdup(service);
handle->id = g_strdup_printf("%x:%x", getpid(), __get_global_sequence_no());
handle->fd = socket(PF_UNIX, SOCK_STREAM, 0);