return retval;
}
+static void release_listener_mutex(void *ptr)
+{
+ pthread_mutex_unlock(&listener_thread_data_mutex);
+}
+
static void listener_cleanup(void *ptr)
{
pthread_mutex_lock(&listen_sock_mutex);
for (i = 0; i < nfds; i++) {
pthread_mutex_lock(&listener_thread_data_mutex);
+ pthread_cleanup_push(release_listener_mutex, NULL);
epoll_sock = (struct ustcomm_sock *)events[i].data.ptr;
if (epoll_sock == listen_sock) {
addr_size = sizeof(struct sockaddr);
epoll_sock->fd);
}
}
- pthread_mutex_unlock(&listener_thread_data_mutex);
+ pthread_cleanup_pop(1); /* release listener mutex */
}
}