Author: tfaber
Date: Fri Oct 24 19:05:54 2014
New Revision: 64970
URL:
http://svn.reactos.org/svn/reactos?rev=64970&view=rev
Log:
[RTL]
- Implement RtlTryEnterHeapLock and use it to fix RtlpDphEnterCriticalSection
Modified:
trunk/reactos/dll/ntdll/rtl/libsupp.c
trunk/reactos/lib/rtl/heappage.c
trunk/reactos/lib/rtl/rtlp.h
trunk/reactos/ntoskrnl/rtl/libsupp.c
Modified: trunk/reactos/dll/ntdll/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/rtl/libsupp.c?re…
==============================================================================
--- trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] Fri Oct 24 19:05:54 2014
@@ -125,6 +125,15 @@
UNREFERENCED_PARAMETER(Exclusive);
return RtlEnterCriticalSection(&Lock->CriticalSection);
+}
+
+BOOLEAN
+NTAPI
+RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
+{
+ UNREFERENCED_PARAMETER(Exclusive);
+
+ return RtlTryEnterCriticalSection(&Lock->CriticalSection);
}
NTSTATUS
Modified: trunk/reactos/lib/rtl/heappage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=649…
==============================================================================
--- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Fri Oct 24 19:05:54 2014
@@ -236,7 +236,7 @@
if (Flags & HEAP_NO_SERIALIZE)
{
/* More complex scenario */
- if (!RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE))
+ if (!RtlTryEnterHeapLock(DphRoot->HeapCritSect, TRUE))
{
if (!DphRoot->nRemoteLockAcquired)
{
Modified: trunk/reactos/lib/rtl/rtlp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtlp.h?rev=64970&a…
==============================================================================
--- trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] Fri Oct 24 19:05:54 2014
@@ -103,6 +103,10 @@
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);
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Fri Oct 24 19:05:54 2014
@@ -176,6 +176,24 @@
ExAcquireResourceSharedLite(&Lock->Resource, TRUE);
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