mirror of
https://github.com/reactos/reactos.git
synced 2024-09-17 08:09:26 +00:00
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
This commit is contained in:
parent
abd7686a78
commit
27780dc59a
|
@ -99,7 +99,6 @@ typedef struct _CRITICAL_SECTION_DEBUG
|
||||||
LIST_ENTRY ProcessLocksList;
|
LIST_ENTRY ProcessLocksList;
|
||||||
ULONG EntryCount;
|
ULONG EntryCount;
|
||||||
ULONG ContentionCount;
|
ULONG ContentionCount;
|
||||||
PVOID OwnerBackTrace[2];
|
|
||||||
PVOID Spare[2];
|
PVOID Spare[2];
|
||||||
} CRITICAL_SECTION_DEBUG, *PCRITICAL_SECTION_DEBUG;
|
} CRITICAL_SECTION_DEBUG, *PCRITICAL_SECTION_DEBUG;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <ntdll/rtl.h>
|
#include <ntdll/rtl.h>
|
||||||
#include <ntos/synch.h>
|
#include <ntos/synch.h>
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <ntdll/ntdll.h>
|
#include <ntdll/ntdll.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
@ -146,6 +146,7 @@ RtlEnterCriticalSection(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't own it, so we must wait for it */
|
/* We don't own it, so we must wait for it */
|
||||||
|
DPRINT ("Waiting\n");
|
||||||
RtlpWaitForCriticalSection(CriticalSection);
|
RtlpWaitForCriticalSection(CriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,14 +487,16 @@ RtlpCreateCriticalSectionSem(
|
||||||
/* Chevk if we have an event */
|
/* Chevk if we have an event */
|
||||||
if (!hEvent) {
|
if (!hEvent) {
|
||||||
|
|
||||||
|
DPRINT ("Creating Event\n");
|
||||||
/* No, so create it */
|
/* No, so create it */
|
||||||
if (NT_SUCCESS(Status = NtCreateEvent(hNewEvent,
|
if (!NT_SUCCESS(Status = NtCreateEvent(&hNewEvent,
|
||||||
EVENT_ALL_ACCESS,
|
EVENT_ALL_ACCESS,
|
||||||
NULL,
|
NULL,
|
||||||
SynchronizationEvent,
|
SynchronizationEvent,
|
||||||
FALSE))) {
|
FALSE))) {
|
||||||
|
|
||||||
/* We failed, this is bad... */
|
/* We failed, this is bad... */
|
||||||
|
DPRINT1("Failed to Create Event!\n");
|
||||||
InterlockedDecrement(&CriticalSection->LockCount);
|
InterlockedDecrement(&CriticalSection->LockCount);
|
||||||
RtlRaiseStatus(Status);
|
RtlRaiseStatus(Status);
|
||||||
return;
|
return;
|
||||||
|
@ -508,11 +511,13 @@ RtlpCreateCriticalSectionSem(
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Some just created an event */
|
/* Some just created an event */
|
||||||
|
DPRINT("Closing already created event!\n");
|
||||||
NtClose(hNewEvent);
|
NtClose(hNewEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set either the new or the old */
|
/* Set either the new or the old */
|
||||||
CriticalSection->LockSemaphore = hEvent;
|
CriticalSection->LockSemaphore = hEvent;
|
||||||
|
DPRINT("Event set!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue