#include <stdint.h>
#include <stdio.h>
-#include <stdbool.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
pthread_mutex_lock(&vsocket->conn_mutex);
TAILQ_INSERT_TAIL(&vsocket->conn_list, conn, next);
pthread_mutex_unlock(&vsocket->conn_mutex);
+
+ fdset_pipe_notify(&vhost_user.fdset);
return;
err:
{
struct vhost_user_socket *vsocket;
static pthread_t fdset_tid;
+ char thread_name[RTE_MAX_THREAD_NAME_LEN];
pthread_mutex_lock(&vhost_user.mutex);
vsocket = find_vhost_user_socket(path);
return -1;
if (fdset_tid == 0) {
+ /**
+ * create a pipe which will be waited by poll and notified to
+ * rebuild the wait list of poll.
+ */
+ if (fdset_pipe_init(&vhost_user.fdset) < 0) {
+ RTE_LOG(ERR, VHOST_CONFIG,
+ "failed to create pipe for vhost fdset\n");
+ return -1;
+ }
+
int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch,
&vhost_user.fdset);
- if (ret != 0)
+ if (ret != 0) {
RTE_LOG(ERR, VHOST_CONFIG,
"failed to create fdset handling thread");
+
+ fdset_pipe_uninit(&vhost_user.fdset);
+ return -1;
+ } else {
+ snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+ "vhost-events");
+
+ if (rte_thread_setname(fdset_tid, thread_name)) {
+ RTE_LOG(DEBUG, VHOST_CONFIG,
+ "failed to set vhost-event thread name");
+ }
+ }
}
if (vsocket->is_server)