ntdll: Avoid importing RtlEnterCriticalSection/RtlLeaveCriticalSection from the Unix side.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-08-05 15:28:23 +02:00
parent 081d25d4b9
commit 1d3e3a1c8d
1 changed files with 14 additions and 3 deletions

View File

@ -2522,9 +2522,20 @@ NTSTATUS CDECL fast_RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variabl
val = *futex;
RtlLeaveCriticalSection( cs );
status = wait_cv( futex, val, timeout );
RtlEnterCriticalSection( cs );
if (cs->RecursionCount == 1)
{
/* FIXME: simplified version of RtlLeaveCriticalSection/RtlEnterCriticalSection to avoid imports */
cs->RecursionCount = 0;
cs->OwningThread = 0;
if (InterlockedDecrement( &cs->LockCount ) >= 0) fast_RtlpUnWaitCriticalSection( cs );
status = wait_cv( futex, val, timeout );
if (InterlockedIncrement( &cs->LockCount )) fast_RtlpWaitForCriticalSection( cs, INT_MAX );
cs->OwningThread = ULongToHandle( GetCurrentThreadId() );
cs->RecursionCount = 1;
}
else status = wait_cv( futex, val, timeout );
return status;
}