Commit 1d3e3a1c authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 081d25d4
......@@ -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;
}
......
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