aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_event.c
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2012-04-11 14:14:09 +0100
committerIan Jackson <ian.jackson@eu.citrix.com>2012-04-11 14:14:09 +0100
commitea68af3ef75f911a26eaf717be3c4b73084597ec (patch)
tree0a68079d7e8cb882c94104258773ec5f0bd670df /tools/libxl/libxl_event.c
parent089f08b94cc7567b5716bfc3bfddbe5ff801a211 (diff)
downloadxen-ea68af3ef75f911a26eaf717be3c4b73084597ec.tar.gz
xen-ea68af3ef75f911a26eaf717be3c4b73084597ec.tar.bz2
xen-ea68af3ef75f911a26eaf717be3c4b73084597ec.zip
libxl: Fix eventloop_iteration over-locking
eventloop_iteration's head comment says that it must be called with the ctx locked exactly once, and this is indeed true, and it's done correctly at both the call sites. However, it takes out the lock an additional time itself. This is wrong because it prevents the unlocks around poll from being effective. This would mean that a multithreaded event-loop using program might suffer from undesired blocking, as one thread trying to enter libxl might end up stalled by another thread waiting for a slow event. So remove those two lock calls. Also add a couple of comments documenting the locking behaviour of libxl__ao_inprogress and libxl__egc_cleanup. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_event.c')
-rw-r--r--tools/libxl/libxl_event.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index c89add8f2f..5ac6334c1a 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -1058,8 +1058,6 @@ static int eventloop_iteration(libxl__egc *egc, libxl__poller *poller) {
int rc;
struct timeval now;
- CTX_LOCK;
-
rc = libxl__gettimeofday(gc, &now);
if (rc) goto out;
@@ -1102,8 +1100,6 @@ static int eventloop_iteration(libxl__egc *egc, libxl__poller *poller) {
afterpoll_internal(egc, poller,
poller->fd_polls_allocd, poller->fd_polls, now);
- CTX_UNLOCK;
-
rc = 0;
out:
return rc;