From: simonmar Date: Thu, 26 Feb 2004 16:21:36 +0000 (+0000) Subject: [project @ 2004-02-26 16:21:36 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~50 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=5b5b3ce352dcd6a4ae1a5b295aea13487d035418;p=ghc-hetmet.git [project @ 2004-02-26 16:21:36 by simonmar] merge rev. 1.6.2.3 from ghc-6-2-branch --- diff --git a/ghc/rts/win32/AwaitEvent.c b/ghc/rts/win32/AwaitEvent.c index 92a84bc..edf65df 100644 --- a/ghc/rts/win32/AwaitEvent.c +++ b/ghc/rts/win32/AwaitEvent.c @@ -20,6 +20,10 @@ #include "Capability.h" #endif +// Used to avoid calling abandonRequestWait() if we don't need to. +// Protected by sched_mutex. +static nat workerWaitingForRequests = 0; + void awaitEvent(rtsBool wait) { @@ -38,9 +42,11 @@ awaitEvent(rtsBool wait) do { /* Try to de-queue completed IO requests */ + workerWaitingForRequests = 1; RELEASE_LOCK(&sched_mutex); ret = awaitRequests(wait); ACQUIRE_LOCK(&sched_mutex); + workerWaitingForRequests = 0; if (!ret) { return; /* still hold the lock */ } @@ -64,7 +70,8 @@ awaitEvent(rtsBool wait) void wakeBlockedWorkerThread() { - abandonRequestWait(); + if (workerWaitingForRequests) { + abandonRequestWait(); + } } #endif -