kernel32: Move condition variable functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-27 17:15:13 +02:00
parent 628d4450cd
commit 9585990a46
4 changed files with 42 additions and 40 deletions

View File

@ -1482,8 +1482,8 @@
@ stdcall SignalObjectAndWait(long long long long)
@ stdcall SizeofResource(long long)
@ stdcall Sleep(long)
@ stdcall SleepConditionVariableCS(ptr ptr long)
@ stdcall SleepConditionVariableSRW(ptr ptr long long)
@ stdcall -import SleepConditionVariableCS(ptr ptr long)
@ stdcall -import SleepConditionVariableSRW(ptr ptr long long)
@ stdcall SleepEx(long long)
# @ stub SortCloseHandle
# @ stub SortGetHandle

View File

@ -1875,39 +1875,3 @@ __ASM_STDCALL_FUNC(InterlockedDecrement, 4,
"ret $4")
#endif /* __i386__ */
/***********************************************************************
* SleepConditionVariableCS (KERNEL32.@)
*/
BOOL WINAPI SleepConditionVariableCS( CONDITION_VARIABLE *variable, CRITICAL_SECTION *crit, DWORD timeout )
{
NTSTATUS status;
LARGE_INTEGER time;
status = RtlSleepConditionVariableCS( variable, crit, get_nt_timeout( &time, timeout ) );
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
return TRUE;
}
/***********************************************************************
* SleepConditionVariableSRW (KERNEL32.@)
*/
BOOL WINAPI SleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable, RTL_SRWLOCK *lock, DWORD timeout, ULONG flags )
{
NTSTATUS status;
LARGE_INTEGER time;
status = RtlSleepConditionVariableSRW( variable, lock, get_nt_timeout( &time, timeout ), flags );
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
return TRUE;
}

View File

@ -1512,8 +1512,8 @@
@ stdcall SignalObjectAndWait(long long long long) kernel32.SignalObjectAndWait
@ stdcall SizeofResource(long long) kernel32.SizeofResource
@ stdcall Sleep(long) kernel32.Sleep
@ stdcall SleepConditionVariableCS(ptr ptr long) kernel32.SleepConditionVariableCS
@ stdcall SleepConditionVariableSRW(ptr ptr long long) kernel32.SleepConditionVariableSRW
@ stdcall SleepConditionVariableCS(ptr ptr long)
@ stdcall SleepConditionVariableSRW(ptr ptr long long)
@ stdcall SleepEx(long long) kernel32.SleepEx
@ stub SpecialMBToWC
@ stub StartThreadpoolIo

View File

@ -45,6 +45,14 @@ static inline BOOL is_version_nt(void)
return !(GetVersion() & 0x80000000);
}
/* helper for kernel32->ntdll timeout format conversion */
static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout )
{
if (timeout == INFINITE) return NULL;
time->QuadPart = (ULONGLONG)timeout * -10000;
return time;
}
/***********************************************************************
* BaseGetNamedObjectDirectory (kernelbase.@)
@ -719,3 +727,33 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileMappingW( DWORD access, BOOL inherit, LP
}
return ret;
}
/***********************************************************************
* Condition variables
***********************************************************************/
/***********************************************************************
* SleepConditionVariableCS (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SleepConditionVariableCS( CONDITION_VARIABLE *variable,
CRITICAL_SECTION *crit, DWORD timeout )
{
LARGE_INTEGER time;
return set_ntstatus( RtlSleepConditionVariableCS( variable, crit, get_nt_timeout( &time, timeout )));
}
/***********************************************************************
* SleepConditionVariableSRW (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
RTL_SRWLOCK *lock, DWORD timeout, ULONG flags )
{
LARGE_INTEGER time;
return set_ntstatus( RtlSleepConditionVariableSRW( variable, lock,
get_nt_timeout( &time, timeout ), flags ));
}