added some lock-free structures

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1719 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2009-08-17 08:21:34 +00:00
parent abb8fb6915
commit a41364e4e4
5 changed files with 195 additions and 11 deletions
+2 -7
View File
@@ -76,13 +76,8 @@ FORCEINLINE VOID KphAcquireBitSpinLock(
__in LONG Bit
)
{
/* Fast path - try to acquire the lock outside of the loop first. */
if (InterlockedBitTestAndSet(Value, Bit))
{
/* Slow path - lock was already acquired by someone else; spin. */
while (InterlockedBitTestAndSet(Value, Bit))
YieldProcessor();
}
while (InterlockedBitTestAndSet(Value, Bit))
YieldProcessor();
}
/* KphReleaseBitSpinLock