mirror of
https://github.com/reactos/reactos.git
synced 2025-04-15 10:03:56 +00:00
[RTL]
- Implement RtlTryEnterHeapLock and use it to fix RtlpDphEnterCriticalSection svn path=/trunk/; revision=64970
This commit is contained in:
parent
5acaa31a62
commit
33e318ed91
4 changed files with 32 additions and 1 deletions
|
@ -127,6 +127,15 @@ RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
|
|||
return RtlEnterCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Exclusive);
|
||||
|
||||
return RtlTryEnterCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock)
|
||||
|
|
|
@ -236,7 +236,7 @@ RtlpDphEnterCriticalSection(PDPH_HEAP_ROOT DphRoot, ULONG Flags)
|
|||
if (Flags & HEAP_NO_SERIALIZE)
|
||||
{
|
||||
/* More complex scenario */
|
||||
if (!RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE))
|
||||
if (!RtlTryEnterHeapLock(DphRoot->HeapCritSect, TRUE))
|
||||
{
|
||||
if (!DphRoot->nRemoteLockAcquired)
|
||||
{
|
||||
|
|
|
@ -103,6 +103,10 @@ NTSTATUS
|
|||
NTAPI
|
||||
RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive);
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock);
|
||||
|
|
|
@ -178,6 +178,24 @@ RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
|
||||
{
|
||||
BOOLEAN Success;
|
||||
KeEnterCriticalRegion();
|
||||
|
||||
if (Exclusive)
|
||||
Success = ExAcquireResourceExclusiveLite(&Lock->Resource, FALSE);
|
||||
else
|
||||
Success = ExAcquireResourceSharedLite(&Lock->Resource, FALSE);
|
||||
|
||||
if (!Success)
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock)
|
||||
|
|
Loading…
Reference in a new issue