From: sof Date: Tue, 23 Apr 2002 06:19:06 +0000 (+0000) Subject: [project @ 2002-04-23 06:19:06 by sof] X-Git-Tag: Approx_11550_changesets_converted~2121 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=80e7e33a1834aac9497a057d9213c87fb9417fbd;p=ghc-hetmet.git [project @ 2002-04-23 06:19:06 by sof] Simplified yieldToReturningWorker(), no need to have OS thread yield --- 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; } diff --git a/ghc/rts/Capability.h b/ghc/rts/Capability.h index 8a3260c..cb0b09b 100644 --- a/ghc/rts/Capability.h +++ b/ghc/rts/Capability.h @@ -42,7 +42,7 @@ extern nat rts_n_free_capabilities; extern nat rts_n_waiting_workers; /* used by Task.c to determine */ extern void grabReturnCapability(Mutex* pMutex, Capability** pCap); -extern void yieldToReturningWorker(Mutex* pMutex, Capability* cap); +extern void yieldToReturningWorker(Mutex* pMutex, Capability** pCap); extern void waitForWorkCapability(Mutex* pMutex, Capability** pCap, rtsBool runnable); static inline nat getFreeCapabilities (void)