Piotr Caban : msvcr100: Improve ThreadScheduler_ScheduleTask_loc stub.
Module: wine Branch: master Commit: 2d2dba53740a3bf6407e19c33e530a84945aceff URL: https://source.winehq.org/git/wine.git/?a=commit;h=2d2dba53740a3bf6407e19c33... 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> --- dlls/msvcrt/concurrency.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dlls/msvcrt/concurrency.c b/dlls/msvcrt/concurrency.c index 54b2c49db99..2ca6421b0e7 100644 --- a/dlls/msvcrt/concurrency.c +++ b/dlls/msvcrt/concurrency.c @@ -1220,11 +1220,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) @@ -1232,6 +1266,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