Commit 34bf8158 authored by Alexandre Julliard's avatar Alexandre Julliard

Got rid of SYSTEM_LOCK macros.

parent 14200e2b
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
extern HANDLE SystemHeap; extern HANDLE SystemHeap;
extern HANDLE SegptrHeap; extern HANDLE SegptrHeap;
extern CRITICAL_SECTION *HEAP_SystemLock;
extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr ); extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
extern SEGPTR HEAP_GetSegptr( 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) { ...@@ -39,14 +38,6 @@ static __inline__ SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
#define SEGPTR_FREE(ptr) \ #define SEGPTR_FREE(ptr) \
(HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) (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 typedef struct
{ {
LPVOID lpData; LPVOID lpData;
......
...@@ -97,7 +97,6 @@ typedef struct tagHEAP ...@@ -97,7 +97,6 @@ typedef struct tagHEAP
HANDLE SystemHeap = 0; HANDLE SystemHeap = 0;
HANDLE SegptrHeap = 0; HANDLE SegptrHeap = 0;
CRITICAL_SECTION *HEAP_SystemLock = NULL;
/*********************************************************************** /***********************************************************************
...@@ -508,12 +507,8 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags, ...@@ -508,12 +507,8 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
/* Initialize critical section */ /* Initialize critical section */
InitializeCriticalSection( &heap->critSection ); InitializeCriticalSection( &heap->critSection );
if (!SystemHeap) if (!SystemHeap) /* System heap critical section has to be global */
{
HEAP_SystemLock = &heap->critSection;
/* System heap critical section has to be global */
MakeCriticalSectionGlobal( &heap->critSection ); MakeCriticalSectionGlobal( &heap->critSection );
}
} }
/* Create the first free block */ /* Create the first free block */
......
...@@ -216,12 +216,12 @@ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, ...@@ -216,12 +216,12 @@ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL,
/* Allocate UTINFO struct */ /* Allocate UTINFO struct */
SYSTEM_LOCK(); HeapLock( SegptrHeap ); /* FIXME: a bit overkill */
if ( (ut = UTFind( hModule )) != NULL ) if ( (ut = UTFind( hModule )) != NULL )
ut = NULL; ut = NULL;
else else
ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack ); ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack );
SYSTEM_UNLOCK(); HeapUnlock( SegptrHeap );
if ( !ut ) if ( !ut )
{ {
...@@ -261,14 +261,14 @@ VOID WINAPI UTUnRegister( HMODULE hModule ) ...@@ -261,14 +261,14 @@ VOID WINAPI UTUnRegister( HMODULE hModule )
UTINFO *ut; UTINFO *ut;
HMODULE16 hModule16 = 0; HMODULE16 hModule16 = 0;
SYSTEM_LOCK(); HeapLock( SegptrHeap ); /* FIXME: a bit overkill */
ut = UTFind( hModule ); ut = UTFind( hModule );
if ( !ut ) if ( !ut )
{ {
hModule16 = ut->hModule16; hModule16 = ut->hModule16;
UTFree( ut ); UTFree( ut );
} }
SYSTEM_UNLOCK(); HeapUnlock( SegptrHeap );
if ( hModule16 ) if ( hModule16 )
FreeLibrary16( hModule16 ); FreeLibrary16( hModule16 );
......
...@@ -305,17 +305,16 @@ MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue ) ...@@ -305,17 +305,16 @@ MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue )
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
SYSTEM_LOCK(); HeapLock( SystemHeap ); /* FIXME: a bit overkill */
queue = GlobalLock16( hQueue ); queue = GlobalLock16( hQueue );
if ( !queue || (queue->magic != QUEUE_MAGIC) ) if ( !queue || (queue->magic != QUEUE_MAGIC) )
{ {
SYSTEM_UNLOCK(); HeapUnlock( SystemHeap );
return NULL; return NULL;
} }
queue->lockCount++; queue->lockCount++;
SYSTEM_UNLOCK(); HeapUnlock( SystemHeap );
return queue; return queue;
} }
...@@ -330,7 +329,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue ) ...@@ -330,7 +329,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue )
{ {
if (queue) if (queue)
{ {
SYSTEM_LOCK(); HeapLock( SystemHeap ); /* FIXME: a bit overkill */
if ( --queue->lockCount == 0 ) if ( --queue->lockCount == 0 )
{ {
...@@ -340,7 +339,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue ) ...@@ -340,7 +339,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue )
GlobalFree16( queue->self ); GlobalFree16( queue->self );
} }
SYSTEM_UNLOCK(); HeapUnlock( SystemHeap );
} }
} }
...@@ -547,7 +546,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) ...@@ -547,7 +546,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
/* flush sent messages */ /* flush sent messages */
QUEUE_FlushMessages( msgQueue ); QUEUE_FlushMessages( msgQueue );
SYSTEM_LOCK(); HeapLock( SystemHeap ); /* FIXME: a bit overkill */
/* Release per queue data if present */ /* Release per queue data if present */
if ( msgQueue->pQData ) if ( msgQueue->pQData )
...@@ -575,7 +574,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) ...@@ -575,7 +574,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
if (pPrev && *pPrev) *pPrev = msgQueue->next; if (pPrev && *pPrev) *pPrev = msgQueue->next;
msgQueue->self = 0; msgQueue->self = 0;
SYSTEM_UNLOCK(); HeapUnlock( SystemHeap );
/* free up resource used by MESSAGEQUEUE strcture */ /* free up resource used by MESSAGEQUEUE strcture */
msgQueue->lockCount--; msgQueue->lockCount--;
...@@ -1401,13 +1400,13 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags ) ...@@ -1401,13 +1400,13 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags )
queuePtr = (MESSAGEQUEUE *)QUEUE_Lock( hQueue ); queuePtr = (MESSAGEQUEUE *)QUEUE_Lock( hQueue );
queuePtr->thdb = THREAD_Current(); queuePtr->thdb = THREAD_Current();
SYSTEM_LOCK(); HeapLock( SystemHeap ); /* FIXME: a bit overkill */
SetThreadQueue16( 0, hQueue ); SetThreadQueue16( 0, hQueue );
thdb->teb.queue = hQueue; thdb->teb.queue = hQueue;
queuePtr->next = hFirstQueue; queuePtr->next = hFirstQueue;
hFirstQueue = hQueue; hFirstQueue = hQueue;
SYSTEM_UNLOCK(); HeapUnlock( SystemHeap );
QUEUE_Unlock( queuePtr ); QUEUE_Unlock( queuePtr );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment