};
struct wl_event_queue {
+ struct wl_list link;
struct wl_list event_list;
+ struct wl_display *display;
pthread_cond_t cond;
};
pthread_t display_thread;
struct wl_map objects;
struct wl_event_queue queue;
+ struct wl_list event_queue_list;
pthread_mutex_t mutex;
};
static int wl_debug = 0;
static void
-wl_event_queue_init(struct wl_event_queue *queue)
+wl_event_queue_init(struct wl_event_queue *queue, struct wl_display *display)
{
wl_list_init(&queue->event_list);
pthread_cond_init(&queue->cond, NULL);
+ queue->display = display;
}
static void
WL_EXPORT void
wl_event_queue_destroy(struct wl_event_queue *queue)
{
+ struct wl_display *display = queue->display;
+
+ pthread_mutex_lock(&display->mutex);
+ wl_list_remove(&queue->link);
wl_event_queue_release(queue);
free(queue);
+ pthread_mutex_unlock(&display->mutex);
}
/** Create a new event queue for this display
if (queue == NULL)
return NULL;
- wl_event_queue_init(queue);
+ wl_event_queue_init(queue, display);
+
+ pthread_mutex_lock(&display->mutex);
+ wl_list_insert(&display->event_queue_list, &queue->link);
+ pthread_mutex_unlock(&display->mutex);
return queue;
}
display->fd = fd;
wl_map_init(&display->objects);
- wl_event_queue_init(&display->queue);
+ wl_event_queue_init(&display->queue, display);
+ wl_list_init(&display->event_queue_list);
pthread_mutex_init(&display->mutex, NULL);
wl_map_insert_new(&display->objects, WL_MAP_CLIENT_SIDE, NULL);