X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FCapability.c;h=d8bdbe6b50fb2965b023fa9bb884eff7112de158;hb=0316a9e603115e6d3f04bd03824a1ca9430b0f0f;hp=1f0d7ff1ef3221bba9dcdcd1422a44df626087ea;hpb=b53a7735911938f8cdf1cf9b4d8c4c5f5666957a;p=ghc-hetmet.git diff --git a/ghc/rts/Capability.c b/ghc/rts/Capability.c index 1f0d7ff..d8bdbe6 100644 --- a/ghc/rts/Capability.c +++ b/ghc/rts/Capability.c @@ -259,24 +259,14 @@ grabReturnCapability(Mutex* pMutex, Capability** pCap) * been given back. */ void -yieldToReturningWorker(Mutex* pMutex, Capability* cap) +yieldToReturningWorker(Mutex* pMutex, Capability** pCap) { if ( rts_n_waiting_workers > 0 && noCapabilities() ) { IF_DEBUG(scheduler, fprintf(stderr,"worker thread (%ld): giving up RTS token\n", osThreadId())); - releaseCapability(cap); - RELEASE_LOCK(pMutex); - yieldThread(); - /* At this point, pMutex has been given up & we've - * forced a thread context switch. Guaranteed to be - * enough for the signalled worker thread to race - * ahead of us? - */ - - /* Re-grab the mutex */ - ACQUIRE_LOCK(pMutex); + releaseCapability(*pCap); /* And wait for work */ - waitForWorkCapability(pMutex, cap, rtsFalse); + waitForWorkCapability(pMutex, pCap, rtsFalse); } return; }