mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[HEAP]
- Move on to using a real HEAP_LOCK structure for a heap lock. - Implement kernel-mode counterparts of this lock too. Right now these don't introduce much of a difference, but they are going to be properly used by the new heap manager code. svn path=/trunk/; revision=48994
This commit is contained in:
parent
04a028b58e
commit
faa70e3d70
3 changed files with 32 additions and 18 deletions
|
@ -113,33 +113,33 @@ RtlGetNtGlobalFlags(VOID)
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
RtlDeleteHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
return RtlDeleteCriticalSection(CriticalSection);
|
||||
return RtlDeleteCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlEnterHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
return RtlEnterCriticalSection(CriticalSection);
|
||||
return RtlEnterCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlInitializeHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
return RtlInitializeCriticalSection(CriticalSection);
|
||||
return RtlInitializeCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlLeaveHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
return RtlLeaveCriticalSection(CriticalSection );
|
||||
return RtlLeaveCriticalSection(&Lock->CriticalSection);
|
||||
}
|
||||
|
||||
PVOID
|
||||
|
|
|
@ -1039,6 +1039,21 @@ typedef struct _RTL_CRITICAL_SECTION
|
|||
|
||||
#endif
|
||||
|
||||
//
|
||||
// RTL Private Heap Structures
|
||||
//
|
||||
typedef struct _HEAP_LOCK
|
||||
{
|
||||
union
|
||||
{
|
||||
RTL_CRITICAL_SECTION CriticalSection;
|
||||
#ifndef NTOS_MODE_USER
|
||||
ERESOURCE Resource;
|
||||
#endif
|
||||
UCHAR Padding[0x68]; /* Max ERESOURCE size for x64 build. Needed because RTL is built only once */
|
||||
};
|
||||
} HEAP_LOCK, *PHEAP_LOCK;
|
||||
|
||||
//
|
||||
// RTL Range List Structures
|
||||
//
|
||||
|
|
|
@ -157,36 +157,35 @@ RtlGetCurrentPeb(VOID)
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
RtlDeleteHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
ExDeleteResource(&Lock->Resource);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlEnterHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
return STATUS_SUCCESS;
|
||||
return ExAcquireResourceExclusive(&Lock->Resource, TRUE);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlInitializeHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
return STATUS_SUCCESS;
|
||||
ExInitializeResource(&Lock->Resource);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlLeaveHeapLock(
|
||||
PRTL_CRITICAL_SECTION CriticalSection)
|
||||
PHEAP_LOCK Lock)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
ExReleaseResource(&Lock->Resource);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue