/* ----------------------------------------------------------------------------
*
- * (c) The GHC Team, 2006-2008
+ * (c) The GHC Team, 2006-2009
*
* Spin locks
*
* 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
r = cas((StgVolatilePtr)&(p->lock), 1, 0);
if (r == 0) {
p->spin++;
+ busy_wait_nop();
goto spin;
}
}
StgWord32 r = 0;
do {
r = cas((StgVolatilePtr)p, 1, 0);
+ busy_wait_nop();
} while(r == 0);
}