summaryrefslogtreecommitdiff
path: root/src/xcb_conn.c
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2006-10-04 12:23:45 -0700
committerJamey Sharp <jamey@minilop.net>2006-10-04 14:52:49 -0700
commit57b0cd8fea498a32ff2322583c7278d5e86aa4e8 (patch)
treeb6dc61ff7ecf3925a2d314ca0e91a23383ca818a /src/xcb_conn.c
parente7f473afbd02c87cc6b1fc9c7c240d6c5cc26763 (diff)
Factor out pthread_mutex_lock and unlock calls for the iolock.
Diffstat (limited to 'src/xcb_conn.c')
-rw-r--r--src/xcb_conn.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index 9aa7cdf..3d18369 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -97,12 +97,12 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
}
assert(count <= sizeof(parts) / sizeof(*parts));
- pthread_mutex_lock(&c->iolock);
+ _xcb_lock_io(c);
{
struct iovec *parts_ptr = parts;
ret = _xcb_out_send(c, &parts_ptr, &count);
}
- pthread_mutex_unlock(&c->iolock);
+ _xcb_unlock_io(c);
return ret;
}
@@ -255,6 +255,16 @@ void _xcb_conn_shutdown(xcb_connection_t *c)
c->has_error = 1;
}
+void _xcb_lock_io(xcb_connection_t *c)
+{
+ pthread_mutex_lock(&c->iolock);
+}
+
+void _xcb_unlock_io(xcb_connection_t *c)
+{
+ pthread_mutex_unlock(&c->iolock);
+}
+
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
{
int ret;
@@ -278,7 +288,7 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
++c->out.writing;
}
- pthread_mutex_unlock(&c->iolock);
+ _xcb_unlock_io(c);
do {
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
} while (ret == -1 && errno == EINTR);
@@ -287,7 +297,7 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
_xcb_conn_shutdown(c);
ret = 0;
}
- pthread_mutex_lock(&c->iolock);
+ _xcb_lock_io(c);
if(ret)
{