From 27780dc59ad79c50170b59f189f2ddd69ee26fcd Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 4 Jan 2005 00:10:50 +0000 Subject: [PATCH] Fix silly bugs in Critical section code. Thanks to Gunnar for finding one of them, thanks to mifritscher for finding the actual regression, and thanks to Filip for being understanding :P svn path=/trunk/; revision=12772 --- reactos/include/ntdll/rtl.h | 1 - reactos/lib/ntdll/rtl/critical.c | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/reactos/include/ntdll/rtl.h b/reactos/include/ntdll/rtl.h index 6cd6ada5f7c..edc5b329b00 100644 --- a/reactos/include/ntdll/rtl.h +++ b/reactos/include/ntdll/rtl.h @@ -99,7 +99,6 @@ typedef struct _CRITICAL_SECTION_DEBUG LIST_ENTRY ProcessLocksList; ULONG EntryCount; ULONG ContentionCount; - PVOID OwnerBackTrace[2]; PVOID Spare[2]; } CRITICAL_SECTION_DEBUG, *PCRITICAL_SECTION_DEBUG; diff --git a/reactos/lib/ntdll/rtl/critical.c b/reactos/lib/ntdll/rtl/critical.c index 2e9002533ec..dac688a27ee 100644 --- a/reactos/lib/ntdll/rtl/critical.c +++ b/reactos/lib/ntdll/rtl/critical.c @@ -16,7 +16,7 @@ #include #include -#define NDEBUG +//#define NDEBUG #include /* FUNCTIONS *****************************************************************/ @@ -146,6 +146,7 @@ RtlEnterCriticalSection( } /* We don't own it, so we must wait for it */ + DPRINT ("Waiting\n"); RtlpWaitForCriticalSection(CriticalSection); } @@ -486,14 +487,16 @@ RtlpCreateCriticalSectionSem( /* Chevk if we have an event */ if (!hEvent) { + DPRINT ("Creating Event\n"); /* No, so create it */ - if (NT_SUCCESS(Status = NtCreateEvent(hNewEvent, - EVENT_ALL_ACCESS, - NULL, - SynchronizationEvent, - FALSE))) { + if (!NT_SUCCESS(Status = NtCreateEvent(&hNewEvent, + EVENT_ALL_ACCESS, + NULL, + SynchronizationEvent, + FALSE))) { /* We failed, this is bad... */ + DPRINT1("Failed to Create Event!\n"); InterlockedDecrement(&CriticalSection->LockCount); RtlRaiseStatus(Status); return; @@ -508,11 +511,13 @@ RtlpCreateCriticalSectionSem( } else { /* Some just created an event */ + DPRINT("Closing already created event!\n"); NtClose(hNewEvent); } /* Set either the new or the old */ CriticalSection->LockSemaphore = hEvent; + DPRINT("Event set!\n"); } return;