[PATCH] client: drop unused event queue cond and list variables

Marek Chalupa mchqwerty at gmail.com
Tue Aug 5 02:42:00 PDT 2014


From: Olivier Blin <olivier.blin at softathome.com>

The wl_event_queue cond variable has been replaced by the wl_display
reader_cond variable (commit 3c7e8bfbb4745315b7bcbf69fa746c3d6718c305).
This cond variable is never waited for anymore, just
signaled/broadcasted, and thus can be safely removed.

The wl_display event_queue_list can be removed as well, since it was
only used to iterate over the event queue list in order to broadcast
the now unused cond.

No regression on queue unit tests.

Signed-off-by: Olivier Blin <olivier.blin at softathome.com>

v2: fixed and rebased after 886b09c9a3a9d8672039f09fe7eaf3f2b2b012ca
    added signed-off-by

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 src/wayland-client.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 19b5694..844138b 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -72,7 +72,6 @@ struct wl_event_queue {
 	struct wl_list link;
 	struct wl_list event_list;
 	struct wl_display *display;
-	pthread_cond_t cond;
 };
 
 struct wl_display {
@@ -101,7 +100,6 @@ struct wl_display {
 	struct wl_map objects;
 	struct wl_event_queue display_queue;
 	struct wl_event_queue default_queue;
-	struct wl_list event_queue_list;
 	pthread_mutex_t mutex;
 
 	int reader_count;
@@ -124,8 +122,6 @@ static int debug_client = 0;
 static void
 display_fatal_error(struct wl_display *display, int error)
 {
-	struct wl_event_queue *iter;
-
 	if (display->last_error)
 		return;
 
@@ -133,9 +129,6 @@ display_fatal_error(struct wl_display *display, int error)
 		error = EFAULT;
 
 	display->last_error = error;
-
-	wl_list_for_each(iter, &display->event_queue_list, link)
-		pthread_cond_broadcast(&iter->cond);
 }
 
 /**
@@ -154,7 +147,6 @@ static void
 display_protocol_error(struct wl_display *display, uint32_t code,
 		       uint32_t id, const struct wl_interface *intf)
 {
-	struct wl_event_queue *iter;
 	int err;
 
 	if (display->last_error)
@@ -185,9 +177,6 @@ display_protocol_error(struct wl_display *display, uint32_t code,
 	display->protocol_error.id = id;
 	display->protocol_error.interface = intf;
 
-	wl_list_for_each(iter, &display->event_queue_list, link)
-		pthread_cond_broadcast(&iter->cond);
-
 	pthread_mutex_unlock(&display->mutex);
 }
 
@@ -195,7 +184,6 @@ static void
 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;
 }
 
@@ -210,7 +198,6 @@ wl_event_queue_release(struct wl_event_queue *queue)
 		wl_list_remove(&closure->link);
 		wl_closure_destroy(closure);
 	}
-	pthread_cond_destroy(&queue->cond);
 }
 
 /** Destroy an event queue
@@ -257,10 +244,6 @@ wl_display_create_queue(struct wl_display *display)
 
 	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;
 }
 
@@ -768,7 +751,6 @@ wl_display_connect_to_fd(int fd)
 	wl_map_init(&display->objects, WL_MAP_CLIENT_SIDE);
 	wl_event_queue_init(&display->default_queue, display);
 	wl_event_queue_init(&display->display_queue, display);
-	wl_list_init(&display->event_queue_list);
 	pthread_mutex_init(&display->mutex, NULL);
 	pthread_cond_init(&display->reader_cond, NULL);
 	display->reader_count = 0;
@@ -1029,8 +1011,6 @@ queue_event(struct wl_display *display, int len)
 	else
 		queue = proxy->queue;
 
-	if (wl_list_empty(&queue->event_list))
-		pthread_cond_signal(&queue->cond);
 	wl_list_insert(queue->event_list.prev, &closure->link);
 
 	return size;
-- 
2.0.4



More information about the wayland-devel mailing list