Commit 9585990a authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move condition variable functions to kernelbase.

parent 628d4450
......@@ -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
......
......@@ -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;
}
......@@ -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
......
......@@ -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 ));
}
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