Got rid of SYSTEM_LOCK macros.

This commit is contained in:
Alexandre Julliard 1999-03-21 08:36:55 +00:00
parent 14200e2b4c
commit 34bf815822
4 changed files with 14 additions and 29 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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 );

View File

@ -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 );
}