#include <cafe/mp.h> inline void MPAcquireSpinLock(MPSpinLock* spinlock);
|spinlock||Pointer to spinlock.|
MPAcquireSpinLock busy-waits to acquire a
MPSpinLock is an inline SMP spinlock implementation, which has a low overhead. This basic spinlock must be used carefully. The intended use is to guard access to shared memory between equal priority threads, each running on a different core.
Important usage notes while holding a spinlock:
Do not continue to hold a
MPSpinLock when a process switch occurs. When performing a process switch, call
OSReleaseForeground. A substantial amount of OS work happens during the call, which requires switching threads and coordinating
with many of the user-mode drivers on multiple cores.
OSSpinLock (as opposed to
MPSpinLock) is designed to handle thread priority inversion issues. Boosting the current thread to highest-priority while holding an
prevents priority-inversion issues. Boosting and deboosting has a time cost and slightly reduces the performance of
|Callbacks||Do not call this function from any callback function.|
2014/06/19 Edited description.
2013/05/08 Automated cleanup pass.
2010/08/23 Initial version.