From 34bf81582286a0e30f132b7f974061ce574eeb12 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 21 Mar 1999 08:36:55 +0000 Subject: [PATCH] Got rid of SYSTEM_LOCK macros. --- include/heap.h | 9 --------- memory/heap.c | 7 +------ relay32/utthunk.c | 8 ++++---- windows/queue.c | 19 +++++++++---------- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/include/heap.h b/include/heap.h index 9b66825cc4c..bb7d180e017 100644 --- a/include/heap.h +++ b/include/heap.h @@ -11,7 +11,6 @@ extern HANDLE SystemHeap; extern HANDLE SegptrHeap; -extern CRITICAL_SECTION *HEAP_SystemLock; extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr ); extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr ); @@ -39,14 +38,6 @@ static __inline__ SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) { #define SEGPTR_FREE(ptr) \ (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) -/* System heap locking macros */ - -#define SYSTEM_LOCK() (EnterCriticalSection(HEAP_SystemLock)) -#define SYSTEM_UNLOCK() (LeaveCriticalSection(HEAP_SystemLock)) -/* Use this one only when you own the lock! */ -#define SYSTEM_LOCK_COUNT() (HEAP_SystemLock->RecursionCount) - - typedef struct { LPVOID lpData; diff --git a/memory/heap.c b/memory/heap.c index 6b00960c255..e6b195d195b 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -97,7 +97,6 @@ typedef struct tagHEAP HANDLE SystemHeap = 0; HANDLE SegptrHeap = 0; -CRITICAL_SECTION *HEAP_SystemLock = NULL; /*********************************************************************** @@ -508,12 +507,8 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags, /* Initialize critical section */ InitializeCriticalSection( &heap->critSection ); - if (!SystemHeap) - { - HEAP_SystemLock = &heap->critSection; - /* System heap critical section has to be global */ + if (!SystemHeap) /* System heap critical section has to be global */ MakeCriticalSectionGlobal( &heap->critSection ); - } } /* Create the first free block */ diff --git a/relay32/utthunk.c b/relay32/utthunk.c index 4a034d5731e..18b0ed01ed7 100644 --- a/relay32/utthunk.c +++ b/relay32/utthunk.c @@ -216,12 +216,12 @@ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, /* Allocate UTINFO struct */ - SYSTEM_LOCK(); + HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ if ( (ut = UTFind( hModule )) != NULL ) ut = NULL; else ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack ); - SYSTEM_UNLOCK(); + HeapUnlock( SegptrHeap ); if ( !ut ) { @@ -261,14 +261,14 @@ VOID WINAPI UTUnRegister( HMODULE hModule ) UTINFO *ut; HMODULE16 hModule16 = 0; - SYSTEM_LOCK(); + HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ ut = UTFind( hModule ); if ( !ut ) { hModule16 = ut->hModule16; UTFree( ut ); } - SYSTEM_UNLOCK(); + HeapUnlock( SegptrHeap ); if ( hModule16 ) FreeLibrary16( hModule16 ); diff --git a/windows/queue.c b/windows/queue.c index 73392cbbaf7..a8ef93f4555 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -305,17 +305,16 @@ MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue ) { MESSAGEQUEUE *queue; - SYSTEM_LOCK(); + HeapLock( SystemHeap ); /* FIXME: a bit overkill */ queue = GlobalLock16( hQueue ); if ( !queue || (queue->magic != QUEUE_MAGIC) ) { - SYSTEM_UNLOCK(); + HeapUnlock( SystemHeap ); return NULL; } queue->lockCount++; - SYSTEM_UNLOCK(); - + HeapUnlock( SystemHeap ); return queue; } @@ -330,7 +329,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue ) { if (queue) { - SYSTEM_LOCK(); + HeapLock( SystemHeap ); /* FIXME: a bit overkill */ if ( --queue->lockCount == 0 ) { @@ -340,7 +339,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue ) GlobalFree16( queue->self ); } - SYSTEM_UNLOCK(); + HeapUnlock( SystemHeap ); } } @@ -547,7 +546,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) /* flush sent messages */ QUEUE_FlushMessages( msgQueue ); - SYSTEM_LOCK(); + HeapLock( SystemHeap ); /* FIXME: a bit overkill */ /* Release per queue data if present */ if ( msgQueue->pQData ) @@ -575,7 +574,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) if (pPrev && *pPrev) *pPrev = msgQueue->next; msgQueue->self = 0; - SYSTEM_UNLOCK(); + HeapUnlock( SystemHeap ); /* free up resource used by MESSAGEQUEUE strcture */ msgQueue->lockCount--; @@ -1401,13 +1400,13 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags ) queuePtr = (MESSAGEQUEUE *)QUEUE_Lock( hQueue ); queuePtr->thdb = THREAD_Current(); - SYSTEM_LOCK(); + HeapLock( SystemHeap ); /* FIXME: a bit overkill */ SetThreadQueue16( 0, hQueue ); thdb->teb.queue = hQueue; queuePtr->next = hFirstQueue; hFirstQueue = hQueue; - SYSTEM_UNLOCK(); + HeapUnlock( SystemHeap ); QUEUE_Unlock( queuePtr ); }