Addresses issues with multiple processes accessing non-global critical
sections.
This commit is contained in:
parent
942010a762
commit
161693e4f9
|
@ -519,8 +519,10 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
|
|||
/* Initialize critical section */
|
||||
|
||||
InitializeCriticalSection( &heap->critSection );
|
||||
if (!SystemHeap) /* System heap critical section has to be global */
|
||||
MakeCriticalSectionGlobal( &heap->critSection );
|
||||
/* FIXME: once separate address spaces are implemented, only */
|
||||
/* the SystemHeap critical section should be global */
|
||||
/* if (!SystemHeap) */
|
||||
MakeCriticalSectionGlobal( &heap->critSection );
|
||||
}
|
||||
|
||||
/* Create the first free block */
|
||||
|
|
|
@ -64,6 +64,12 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
|
|||
FIXME_(win32)("entering uninitialized section(%p)?\n",crit);
|
||||
InitializeCriticalSection(crit);
|
||||
}
|
||||
if ( crit->Reserved && crit->Reserved != GetCurrentProcessId() )
|
||||
{
|
||||
FIXME_(win32)("Crst %p belongs to process %ld, current is %ld!\n",
|
||||
crit, crit->Reserved, GetCurrentProcessId() );
|
||||
return;
|
||||
}
|
||||
if (InterlockedIncrement( &crit->LockCount ))
|
||||
{
|
||||
if (crit->OwningThread == GetCurrentThreadId())
|
||||
|
@ -71,15 +77,8 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
|
|||
crit->RecursionCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now wait for it */
|
||||
|
||||
if ( crit->Reserved && crit->Reserved != GetCurrentProcessId() )
|
||||
{
|
||||
FIXME_(win32)("Crst %p belongs to process %ld, current is %ld!\n",
|
||||
crit, crit->Reserved, GetCurrentProcessId() );
|
||||
return;
|
||||
}
|
||||
|
||||
res = WaitForSingleObject( crit->LockSemaphore, 5000L );
|
||||
if ( res == WAIT_TIMEOUT )
|
||||
{
|
||||
|
|
|
@ -85,6 +85,8 @@ PERQUEUEDATA * PERQDATA_CreateInstance( )
|
|||
* since this may be shared by different threads. see AttachThreadInput()
|
||||
*/
|
||||
InitializeCriticalSection( &pQData->cSection );
|
||||
/* FIXME: not all per queue data critical sections should be global */
|
||||
MakeCriticalSectionGlobal( &pQData->cSection );
|
||||
|
||||
/* Save perQData globally for 16 bit tasks */
|
||||
if ( bIsWin16 )
|
||||
|
|
Loading…
Reference in New Issue