Commit 65d02b7a authored by Marek Chalupa's avatar Marek Chalupa Committed by Pekka Paalanen

display-test: test if threads are woken up on EAGAIN

When wl_connection_read() in wl_display_read_events() returns with EAGAIN,
we want the sleeping threads to be woken up. Test it!
Signed-off-by: default avatarMarek Chalupa <>
Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <>
parent d8377411
......@@ -495,6 +495,45 @@ TEST(threading_cancel_read_tst)
static void
struct client *c = client_connect();
pthread_t th1, th2, th3;
th1 = create_thread(c, thread_prepare_and_read);
th2 = create_thread(c, thread_prepare_and_read);
th3 = create_thread(c, thread_prepare_and_read);
/* All the threads are sleeping, waiting until read or cancel
* is called. Since we have no data on socket waiting,
* the wl_connection_read should end up with error and set errno
* to EAGAIN. Check if the threads are woken up in this case. */
assert(wl_display_read_events(c->wl_display) == 0);
/* errno should be still set to EAGAIN if wl_connection_read
* set it - check if we're testing the right case */
assert(errno == EAGAIN);
pthread_join(th1, NULL);
pthread_join(th2, NULL);
pthread_join(th3, NULL);
struct display *d = display_create();
client_create(d, threading_read_eagain);
static void *
thread_prepare_and_read2(void *data)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment