From 879f12f1f8caf514e2201109aa1cfba1c740a110 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 19 Feb 2005 14:30:32 +0000 Subject: [PATCH] revert my changes to RtlTryEnterCriticalSection() svn path=/trunk/; revision=13643 --- reactos/lib/ntdll/rtl/critical.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/reactos/lib/ntdll/rtl/critical.c b/reactos/lib/ntdll/rtl/critical.c index 4771e3fe5fa..16a96253b4a 100644 --- a/reactos/lib/ntdll/rtl/critical.c +++ b/reactos/lib/ntdll/rtl/critical.c @@ -360,29 +360,29 @@ RtlLeaveCriticalSection( * None * *--*/ -BOOLEAN +BOOLEAN STDCALL RtlTryEnterCriticalSection( PRTL_CRITICAL_SECTION CriticalSection) -{ +{ /* 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 - because we just obtained the lock. */ + /* It's ours */ CriticalSection->OwningThread = NtCurrentTeb()->Cid.UniqueThread; CriticalSection->RecursionCount = 1; return TRUE; - + } else if (CriticalSection->OwningThread == NtCurrentTeb()->Cid.UniqueThread) { - - /* It's already ours, just increment the recursion counter. This doesn't - have to be serialized because only the thread who already holds the - lock can do this. */ + + /* It's already ours */ + InterlockedIncrement(&CriticalSection->LockCount); CriticalSection->RecursionCount++; return TRUE; } - + /* It's not ours */ return FALSE; }