From 25d3bf68ab7856859d6ce2e81bf30062030d01d7 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Thu, 25 Aug 2005 12:33:37 +0000 Subject: [PATCH] Fixed a bug in RtlLeaveCriticalSection. We have only to signal the event if someone waits on it. svn path=/trunk/; revision=17538 --- reactos/lib/ntdll/rtl/critical.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/lib/ntdll/rtl/critical.c b/reactos/lib/ntdll/rtl/critical.c index a7b34c40374..60b5de0af20 100644 --- a/reactos/lib/ntdll/rtl/critical.c +++ b/reactos/lib/ntdll/rtl/critical.c @@ -329,10 +329,11 @@ RtlLeaveCriticalSection( CriticalSection->OwningThread = 0; /* Was someone wanting us? This needs to be done atomically. */ - InterlockedDecrement(&CriticalSection->LockCount); + if (-1 != InterlockedDecrement(&CriticalSection->LockCount)) { - /* Let him have us */ - RtlpUnWaitCriticalSection(CriticalSection); + /* Let him have us */ + RtlpUnWaitCriticalSection(CriticalSection); + } } /* Sucessful! */