Module: wine Branch: master Commit: 9585990a46442a36dd0ecca770847f0b56966eea URL: https://source.winehq.org/git/wine.git/?a=commit;h=9585990a46442a36dd0ecca77...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jun 27 17:15:13 2019 +0200
kernel32: Move condition variable functions to kernelbase.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/kernel32.spec | 4 ++-- dlls/kernel32/sync.c | 36 ------------------------------------ dlls/kernelbase/kernelbase.spec | 4 ++-- dlls/kernelbase/sync.c | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 40 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index bd4f551..c42ec44 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -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 diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index 036bf85..be92aee 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -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; -} diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 7851675..52982b2 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -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 diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index 5ab9005..ba64b85 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -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 )); +}