Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/78e6b615329dd8ea4527b499107048693c87f895 >--------------------------------------------------------------- commit 78e6b615329dd8ea4527b499107048693c87f895 Author: Simon Marlow <[email protected]> Date: Wed Aug 3 13:41:33 2011 +0100 small optimisation for the program in #5367: if the worker thread being woken already has its wakeup flag set, don't bother signalling its condition variable again. >--------------------------------------------------------------- rts/Capability.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rts/Capability.c b/rts/Capability.c index 91c5e2d..57c75e6 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -366,11 +366,13 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task) cap->no, task->incall->tso ? "bound task" : "worker", (void *)task->id); ACQUIRE_LOCK(&task->lock); - task->wakeup = rtsTrue; - // the wakeup flag is needed because signalCondition() doesn't - // flag the condition if the thread is already runniing, but we want - // it to be sticky. - signalCondition(&task->cond); + if (task->wakeup == rtsFalse) { + task->wakeup = rtsTrue; + // the wakeup flag is needed because signalCondition() doesn't + // flag the condition if the thread is already runniing, but we want + // it to be sticky. + signalCondition(&task->cond); + } RELEASE_LOCK(&task->lock); } #endif _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
