Stefan Dösinger : msvcp: Cast the wait time in _Cnd_timedwait to ULONG.
Module: wine Branch: master Commit: 3ea7102cbe4a365f4364bc633f4b7f31f168c1ed URL: http://source.winehq.org/git/wine.git/?a=commit;h=3ea7102cbe4a365f4364bc633f... Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Dec 6 13:50:21 2017 +0100 msvcp: Cast the wait time in _Cnd_timedwait to ULONG. This prevents sign extending it when promoting it to ULONGLONG. This fixes high CPU usage in Wargaming Game Center that was caused by _Cnd_timedwait instantly returning timeout instead of waiting for the requested 30 days. Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcp90/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 901930b..159e9d6 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -635,7 +635,7 @@ int __cdecl _Cnd_timedwait(_Cnd_arg_t cnd, _Mtx_arg_t mtx, const xtime *xt) InterlockedExchangeAdd( (LONG *)&cv->Ptr, 1 ); _Mtx_unlock(mtx); - timeout.QuadPart = (ULONGLONG)_Xtime_diff_to_millis(xt) * -10000; + timeout.QuadPart = (ULONGLONG)(ULONG)_Xtime_diff_to_millis(xt) * -10000; status = NtWaitForKeyedEvent(keyed_event, &cv->Ptr, FALSE, &timeout); if (status) {
participants (1)
-
Alexandre Julliard