mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 17:03:01 +00:00
[RTL]
_Interlocked(Compare)ExchangePointer is an intrinsic that doesn't exist on x86, use portable version. svn path=/branches/cmake-bringup/; revision=50522
This commit is contained in:
parent
0af4984309
commit
d57a12e96a
1 changed files with 23 additions and 23 deletions
|
@ -131,7 +131,7 @@ RtlpReleaseWaitBlockLockExclusive(IN OUT PRTL_SRWLOCK SRWLock,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)_InterlockedExchangePointer(&SRWLock->Ptr, (PVOID)NewValue);
|
(void)InterlockedExchangePointer(&SRWLock->Ptr, (PVOID)NewValue);
|
||||||
|
|
||||||
if (FirstWaitBlock->Exclusive)
|
if (FirstWaitBlock->Exclusive)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +186,7 @@ RtlpReleaseWaitBlockLockLastShared(IN OUT PRTL_SRWLOCK SRWLock,
|
||||||
NewValue = RTL_SRWLOCK_OWNED;
|
NewValue = RTL_SRWLOCK_OWNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)_InterlockedExchangePointer(&SRWLock->Ptr, (PVOID)NewValue);
|
(void)InterlockedExchangePointer(&SRWLock->Ptr, (PVOID)NewValue);
|
||||||
|
|
||||||
(void)InterlockedOr(&FirstWaitBlock->Wake,
|
(void)InterlockedOr(&FirstWaitBlock->Wake,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
@ -420,9 +420,9 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
NewValue = (CurrentValue >> RTL_SRWLOCK_BITS) + 1;
|
NewValue = (CurrentValue >> RTL_SRWLOCK_BITS) + 1;
|
||||||
NewValue = (NewValue << RTL_SRWLOCK_BITS) | (CurrentValue & RTL_SRWLOCK_MASK);
|
NewValue = (NewValue << RTL_SRWLOCK_BITS) | (CurrentValue & RTL_SRWLOCK_MASK);
|
||||||
|
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
/* Successfully incremented the shared count, we acquired the lock */
|
/* Successfully incremented the shared count, we acquired the lock */
|
||||||
break;
|
break;
|
||||||
|
@ -499,9 +499,9 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||||
|
|
||||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
RtlpAcquireSRWLockSharedWait(SRWLock,
|
RtlpAcquireSRWLockSharedWait(SRWLock,
|
||||||
&StackWaitBlock,
|
&StackWaitBlock,
|
||||||
|
@ -521,9 +521,9 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
RTL_SRWLOCK_SHARED nor the RTL_SRWLOCK_OWNED bit is set */
|
RTL_SRWLOCK_SHARED nor the RTL_SRWLOCK_OWNED bit is set */
|
||||||
ASSERT(!(CurrentValue & RTL_SRWLOCK_CONTENDED));
|
ASSERT(!(CurrentValue & RTL_SRWLOCK_CONTENDED));
|
||||||
|
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
/* Successfully set the shared count, we acquired the lock */
|
/* Successfully set the shared count, we acquired the lock */
|
||||||
break;
|
break;
|
||||||
|
@ -580,9 +580,9 @@ RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
NewValue = (NewValue << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED;
|
NewValue = (NewValue << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
/* Successfully released the lock */
|
/* Successfully released the lock */
|
||||||
break;
|
break;
|
||||||
|
@ -639,9 +639,9 @@ RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
|
|
||||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED;
|
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED;
|
||||||
|
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
RtlpAcquireSRWLockExclusiveWait(SRWLock,
|
RtlpAcquireSRWLockExclusiveWait(SRWLock,
|
||||||
&StackWaitBlock);
|
&StackWaitBlock);
|
||||||
|
@ -697,9 +697,9 @@ AddWaitBlock:
|
||||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||||
|
|
||||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
RtlpAcquireSRWLockExclusiveWait(SRWLock,
|
RtlpAcquireSRWLockExclusiveWait(SRWLock,
|
||||||
&StackWaitBlock);
|
&StackWaitBlock);
|
||||||
|
@ -767,9 +767,9 @@ RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
|
||||||
ASSERT(!(CurrentValue & ~RTL_SRWLOCK_OWNED));
|
ASSERT(!(CurrentValue & ~RTL_SRWLOCK_OWNED));
|
||||||
|
|
||||||
NewValue = 0;
|
NewValue = 0;
|
||||||
if ((LONG_PTR)_InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||||
(PVOID)NewValue,
|
(PVOID)NewValue,
|
||||||
(PVOID)CurrentValue) == CurrentValue)
|
(PVOID)CurrentValue) == CurrentValue)
|
||||||
{
|
{
|
||||||
/* We released the lock */
|
/* We released the lock */
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue