Addresses issues with multiple processes accessing non-global critical

sections.
This commit is contained in:
James Abbatiello 1999-11-07 19:22:46 +00:00 committed by Alexandre Julliard
parent 942010a762
commit 161693e4f9
3 changed files with 13 additions and 10 deletions

View File

@ -519,8 +519,10 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
/* Initialize critical section */ /* Initialize critical section */
InitializeCriticalSection( &heap->critSection ); InitializeCriticalSection( &heap->critSection );
if (!SystemHeap) /* System heap critical section has to be global */ /* FIXME: once separate address spaces are implemented, only */
MakeCriticalSectionGlobal( &heap->critSection ); /* the SystemHeap critical section should be global */
/* if (!SystemHeap) */
MakeCriticalSectionGlobal( &heap->critSection );
} }
/* Create the first free block */ /* Create the first free block */

View File

@ -64,6 +64,12 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
FIXME_(win32)("entering uninitialized section(%p)?\n",crit); FIXME_(win32)("entering uninitialized section(%p)?\n",crit);
InitializeCriticalSection(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 (InterlockedIncrement( &crit->LockCount ))
{ {
if (crit->OwningThread == GetCurrentThreadId()) if (crit->OwningThread == GetCurrentThreadId())
@ -71,15 +77,8 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
crit->RecursionCount++; crit->RecursionCount++;
return; return;
} }
/* Now wait for it */ /* 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 ); res = WaitForSingleObject( crit->LockSemaphore, 5000L );
if ( res == WAIT_TIMEOUT ) if ( res == WAIT_TIMEOUT )
{ {

View File

@ -85,6 +85,8 @@ PERQUEUEDATA * PERQDATA_CreateInstance( )
* since this may be shared by different threads. see AttachThreadInput() * since this may be shared by different threads. see AttachThreadInput()
*/ */
InitializeCriticalSection( &pQData->cSection ); InitializeCriticalSection( &pQData->cSection );
/* FIXME: not all per queue data critical sections should be global */
MakeCriticalSectionGlobal( &pQData->cSection );
/* Save perQData globally for 16 bit tasks */ /* Save perQData globally for 16 bit tasks */
if ( bIsWin16 ) if ( bIsWin16 )