diff options
author | Jamey Sharp <jamey@minilop.net> | 2011-04-12 13:09:23 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2011-04-12 13:11:48 -0700 |
commit | e300ee4920bf4618f58618f3063b362f811154c1 (patch) | |
tree | a4ed0b8e8a62d48606e935343b8831d852fe818e /src/xcb_in.c | |
parent | 527df3c84bd71113cedc7f55089c02d1c099ecad (diff) |
Revert "Introduce xcb_wait_for_event_until, for consuming responses in wire-order."
This function was intended to allow libX11 to fix a multi-threaded hang,
but the corresponding libX11 patch caused single-threaded apps to spin
sometimes. Since I've retracted that patch, this patch has no users and
shouldn't go into a release unless/until that changes.
This reverts commit 2415c11dec5e5adb0c17f98aa52fbb371a4f8f23.
Conflicts:
src/xcb.h
src/xcb_in.c
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'src/xcb_in.c')
-rw-r--r-- | src/xcb_in.c | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/src/xcb_in.c b/src/xcb_in.c index 6107065..4acc3a2 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -57,7 +57,6 @@ #endif struct event_list { - uint64_t sequence; xcb_generic_event_t *event; struct event_list *next; }; @@ -126,7 +125,7 @@ static int read_packet(xcb_connection_t *c) c->in.current_reply = 0; c->in.current_reply_tail = &c->in.current_reply; } - c->in.request_completed = c->in.event_responses_completed = c->in.request_read - 1; + c->in.request_completed = c->in.request_read - 1; } while(c->in.pending_replies && @@ -141,12 +140,9 @@ static int read_packet(xcb_connection_t *c) } if(genrep.response_type == XCB_ERROR) - c->in.request_completed = c->in.event_responses_completed = c->in.request_read; - else if(genrep.response_type == XCB_REPLY) - c->in.event_responses_completed = c->in.request_read; + c->in.request_completed = c->in.request_read; remove_finished_readers(&c->in.readers, c->in.request_completed); - remove_finished_readers(&c->in.event_readers, c->in.event_responses_completed); } if(genrep.response_type == XCB_ERROR || genrep.response_type == XCB_REPLY) @@ -235,15 +231,11 @@ static int read_packet(xcb_connection_t *c) free(buf); return 0; } - event->sequence = c->in.request_read; event->event = buf; event->next = 0; *c->in.events_tail = event; c->in.events_tail = &event->next; - if(c->in.event_readers) - pthread_cond_signal(c->in.event_readers->data); - else - pthread_cond_signal(&c->in.event_cond); + pthread_cond_signal(&c->in.event_cond); return 1; /* I have something for you... */ } @@ -560,35 +552,6 @@ xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c) return poll_for_next_event(c, 1); } -static xcb_generic_event_t *get_event_until(xcb_connection_t *c, uint64_t request) -{ - if(c->in.events && XCB_SEQUENCE_COMPARE(c->in.events->sequence, <=, request)) - return get_event(c); - return 0; -} - -xcb_generic_event_t *xcb_wait_for_event_until(xcb_connection_t *c, unsigned int request) -{ - pthread_cond_t cond = PTHREAD_COND_INITIALIZER; - reader_list reader; - xcb_generic_event_t *ret; - if(c->has_error) - return 0; - pthread_mutex_lock(&c->iolock); - - insert_reader(&c->in.event_readers, &reader, widen(c, request), &cond); - - while(!(ret = get_event_until(c, reader.request)) && XCB_SEQUENCE_COMPARE(c->in.event_responses_completed, <, reader.request)) - if(!_xcb_conn_wait(c, &cond, 0, 0)) - break; - - remove_reader(&c->in.event_readers, &reader); - pthread_cond_destroy(&cond); - _xcb_in_wake_up_next_reader(c); - pthread_mutex_unlock(&c->iolock); - return ret; -} - xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie) { uint64_t request; @@ -659,8 +622,6 @@ void _xcb_in_wake_up_next_reader(xcb_connection_t *c) int pthreadret; if(c->in.readers) pthreadret = pthread_cond_signal(c->in.readers->data); - else if(c->in.event_readers) - pthreadret = pthread_cond_signal(c->in.event_readers->data); else pthreadret = pthread_cond_signal(&c->in.event_cond); assert(pthreadret == 0); |