Module: wine Branch: master Commit: d3d9297b60214cc29027d3546f87001b2114b825 URL: https://gitlab.winehq.org/wine/wine/-/commit/d3d9297b60214cc29027d3546f87001...
Author: Piotr Caban piotr@codeweavers.com Date: Thu Jun 8 15:27:00 2023 +0200
msvcr100: Use block_context_for helper in Concurrency::wait().
---
dlls/msvcrt/concurrency.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/dlls/msvcrt/concurrency.c b/dlls/msvcrt/concurrency.c index 560159ee00d..aed911a52a3 100644 --- a/dlls/msvcrt/concurrency.c +++ b/dlls/msvcrt/concurrency.c @@ -2569,7 +2569,6 @@ static void set_timeout(FILETIME *ft, unsigned int timeout) ft->dwLowDateTime = to.QuadPart; }
-#if _MSVCR_VER >= 110 struct timeout_unlock { Context *ctx; @@ -2611,6 +2610,7 @@ static BOOL block_context_for(Context *ctx, unsigned int timeout) return tu.timed_out; }
+#if _MSVCR_VER >= 110 /* ?try_lock_for@critical_section@Concurrency@@QAE_NI@Z */ /* ?try_lock_for@critical_section@Concurrency@@QEAA_NI@Z */ DEFINE_THISCALL_WRAPPER(critical_section_try_lock_for, 8) @@ -3478,33 +3478,11 @@ bool __thiscall _ReentrantBlockingLock__TryAcquire(_ReentrantBlockingLock *this) return TryEnterCriticalSection(&this->cs); }
-static void WINAPI wait_timeout(TP_CALLBACK_INSTANCE *instance, void *arg, TP_TIMER *timer) -{ - Context *ctx = arg; - - call_Context_Unblock(ctx); -} - /* ?wait@Concurrency@@YAXI@Z */ void __cdecl Concurrency_wait(unsigned int time) { - Context *ctx = get_current_context(); - TP_TIMER *tp_timer; - FILETIME ft; - TRACE("(%d)\n", time); - - tp_timer = CreateThreadpoolTimer(wait_timeout, ctx, NULL); - if(!tp_timer) { - FIXME("throw exception?\n"); - Sleep(time); - return; - } - set_timeout(&ft, time); - SetThreadpoolTimer(tp_timer, &ft, 0, 0); - - call_Context_Block(ctx); - CloseThreadpoolTimer(tp_timer); + block_context_for(get_current_context(), time); }
#if _MSVCR_VER>=110