Piotr Caban : msvcr100: Improve ThreadScheduler_ScheduleTask_loc stub.
Module: wine Branch: stable Commit: 85e0b34b19f60f6258cb0a012aadb7d7eeb0c28b URL: https://gitlab.winehq.org/wine/wine/-/commit/85e0b34b19f60f6258cb0a012aadb7d... Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sun Apr 3 20:30:41 2022 +0200 msvcr100: Improve ThreadScheduler_ScheduleTask_loc stub. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45916 Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 2d2dba53740a3bf6407e19c33e530a84945aceff) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/msvcrt/concurrency.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dlls/msvcrt/concurrency.c b/dlls/msvcrt/concurrency.c index e9047ab41b9..f66dfa43f36 100644 --- a/dlls/msvcrt/concurrency.c +++ b/dlls/msvcrt/concurrency.c @@ -1217,11 +1217,45 @@ DEFINE_THISCALL_WRAPPER(ThreadScheduler_CreateScheduleGroup, 4) return NULL; } +typedef struct +{ + void (__cdecl *proc)(void*); + void *data; +} schedule_task_arg; + +static void WINAPI schedule_task_proc(PTP_CALLBACK_INSTANCE instance, void *context, PTP_WORK work) +{ + schedule_task_arg arg; + + arg = *(schedule_task_arg*)context; + operator_delete(context); + arg.proc(arg.data); +} + DEFINE_THISCALL_WRAPPER(ThreadScheduler_ScheduleTask_loc, 16) void __thiscall ThreadScheduler_ScheduleTask_loc(ThreadScheduler *this, void (__cdecl *proc)(void*), void* data, /*location*/void *placement) { + schedule_task_arg *arg; + TP_WORK *work; + FIXME("(%p %p %p %p) stub\n", this, proc, data, placement); + + arg = operator_new(sizeof(*arg)); + arg->proc = proc; + arg->data = data; + + work = CreateThreadpoolWork(schedule_task_proc, arg, NULL); + if(!work) { + scheduler_resource_allocation_error e; + + operator_delete(arg); + scheduler_resource_allocation_error_ctor_name(&e, NULL, + HRESULT_FROM_WIN32(GetLastError())); + _CxxThrowException(&e, &scheduler_resource_allocation_error_exception_type); + } + SubmitThreadpoolWork(work); + CloseThreadpoolWork(work); } DEFINE_THISCALL_WRAPPER(ThreadScheduler_ScheduleTask, 12) @@ -1229,6 +1263,7 @@ void __thiscall ThreadScheduler_ScheduleTask(ThreadScheduler *this, void (__cdecl *proc)(void*), void* data) { FIXME("(%p %p %p) stub\n", this, proc, data); + ThreadScheduler_ScheduleTask_loc(this, proc, data, NULL); } DEFINE_THISCALL_WRAPPER(ThreadScheduler_IsAvailableLocation, 8)
participants (1)
-
Alexandre Julliard