mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
revert my changes to RtlTryEnterCriticalSection()
svn path=/trunk/; revision=13643
This commit is contained in:
parent
f66a4cec4d
commit
879f12f1f8
1 changed files with 11 additions and 11 deletions
|
@ -366,19 +366,19 @@ RtlTryEnterCriticalSection(
|
||||||
PRTL_CRITICAL_SECTION CriticalSection)
|
PRTL_CRITICAL_SECTION CriticalSection)
|
||||||
{
|
{
|
||||||
/* Try to take control */
|
/* Try to take control */
|
||||||
if (InterlockedCompareExchange(&CriticalSection->LockCount, 0, -1) == -1) {
|
if (InterlockedCompareExchange(&CriticalSection->LockCount,
|
||||||
|
0,
|
||||||
|
-1) == -1) {
|
||||||
|
|
||||||
/* It's ours. Changing this information does not have to be serialized
|
/* It's ours */
|
||||||
because we just obtained the lock. */
|
|
||||||
CriticalSection->OwningThread = NtCurrentTeb()->Cid.UniqueThread;
|
CriticalSection->OwningThread = NtCurrentTeb()->Cid.UniqueThread;
|
||||||
CriticalSection->RecursionCount = 1;
|
CriticalSection->RecursionCount = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else if (CriticalSection->OwningThread == NtCurrentTeb()->Cid.UniqueThread) {
|
} else if (CriticalSection->OwningThread == NtCurrentTeb()->Cid.UniqueThread) {
|
||||||
|
|
||||||
/* It's already ours, just increment the recursion counter. This doesn't
|
/* It's already ours */
|
||||||
have to be serialized because only the thread who already holds the
|
InterlockedIncrement(&CriticalSection->LockCount);
|
||||||
lock can do this. */
|
|
||||||
CriticalSection->RecursionCount++;
|
CriticalSection->RecursionCount++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue