diff options
author | Keith Packard <keithp@keithp.com> | 2013-12-23 21:15:20 -0800 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2014-03-30 22:15:38 +0200 |
commit | be0fe56c3bcad5124dcc6c47a2fad01acd16f71a (patch) | |
tree | dda9b02d3df27bb38c591a41087c996c52970045 /src/xcb_util.c | |
parent | e2813e1cde893f384fa620ff3c13493beebabe0c (diff) |
Ensure xcb owns socket and no other threads are writing before send_request
send_request may only write to out.queue if no other thread is busy
writing to the network (as that thread may be writing from out.queue).
send_request may only allocate request sequence numbers if XCB owns
the socket.
Therefore, send_request must make sure that both conditions are true
when it holds iolock, which can only be done by looping until both
conditions are true without having dropped the lock waiting for the
second condition.
We choose to get the socket back from Xlib first as get_socket_back
has a complicated test and checking for other threads writing is a
simple in-lined check.
This also changes the sequence number checks (64k requests with no
reply, 4M request wrapping) to ensure that both conditions are true
before queueing the request.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/xcb_util.c')
0 files changed, 0 insertions, 0 deletions