X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2Frts%2FSpinLock.h;h=3d0b56cfcbd6e2d98e88cde8159b1fbdee68e098;hb=0ee6cfbe62211121fc84a9d2e500f414f9e397f7;hp=ea992a3457153edee9fc132f10fe5ebe058ff66a;hpb=a2a67cd520b9841114d69a87a423dabcb3b4368e;p=ghc-hetmet.git diff --git a/includes/rts/SpinLock.h b/includes/rts/SpinLock.h index ea992a3..3d0b56c 100644 --- a/includes/rts/SpinLock.h +++ b/includes/rts/SpinLock.h @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * - * (c) The GHC Team, 2006-2008 + * (c) The GHC Team, 2006-2009 * * Spin locks * @@ -12,6 +12,11 @@ * TODO: measure whether we really need these, or whether Mutexes * would do (and be a bit safer if a CPU becomes loaded). * + * Do not #include this file directly: #include "Rts.h" instead. + * + * To understand the structure of the RTS headers, see the wiki: + * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes + * * -------------------------------------------------------------------------- */ #ifndef RTS_SPINLOCK_H @@ -44,6 +49,7 @@ spin: r = cas((StgVolatilePtr)&(p->lock), 1, 0); if (r == 0) { p->spin++; + busy_wait_nop(); goto spin; } } @@ -71,6 +77,7 @@ INLINE_HEADER void ACQUIRE_SPIN_LOCK(SpinLock * p) StgWord32 r = 0; do { r = cas((StgVolatilePtr)p, 1, 0); + busy_wait_nop(); } while(r == 0); }