From: Daniel Lehman Subject: [PATCH v2 5/6] msvcp140_atomic_wait: Implement __std_close_threadpool_work. Message-Id: Date: Thu, 27 Jan 2022 16:37:49 +0000 From cc0839eaf8f8fa1cd7f4041abc9aa942e1382274 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Fri, 21 Jan 2022 16:31:54 -0800 Subject: [PATCH v2 5/6] msvcp140_atomic_wait: Implement __std_close_threadpool_work. Signed-off-by: Daniel Lehman --- dlls/msvcp140_atomic_wait/main.c | 6 ++++++ dlls/msvcp140_atomic_wait/msvcp140_atomic_wait.spec | 2 +- dlls/msvcp140_atomic_wait/tests/msvcp140_atomic_wait.c | 9 ++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp140_atomic_wait/main.c b/dlls/msvcp140_atomic_wait/main.c index 28e86b93d7d..c00ed08bffe 100644 --- a/dlls/msvcp140_atomic_wait/main.c +++ b/dlls/msvcp140_atomic_wait/main.c @@ -31,6 +31,12 @@ unsigned int __stdcall __std_parallel_algorithms_hw_threads(void) return _Thrd_hardware_concurrency(); } +void __stdcall __std_close_threadpool_work(PTP_WORK work) +{ + TRACE("(%p)\n", work); + return CloseThreadpoolWork(work); +} + PTP_WORK __stdcall __std_create_threadpool_work(PTP_WORK_CALLBACK callback, void *context, PTP_CALLBACK_ENVIRON environ) { diff --git a/dlls/msvcp140_atomic_wait/msvcp140_atomic_wait.spec b/dlls/msvcp140_atomic_wait/msvcp140_atomic_wait.spec index cc8bc0e404e..5b03b7ccfe8 100644 --- a/dlls/msvcp140_atomic_wait/msvcp140_atomic_wait.spec +++ b/dlls/msvcp140_atomic_wait/msvcp140_atomic_wait.spec @@ -13,7 +13,7 @@ @ stub __std_atomic_wait_indirect @ stub __std_bulk_submit_threadpool_work @ stub __std_calloc_crt -@ stub __std_close_threadpool_work +@ stdcall __std_close_threadpool_work(ptr) @ stdcall __std_create_threadpool_work(ptr ptr ptr) @ stub __std_execution_wait_on_uchar @ stub __std_execution_wake_by_address_all diff --git a/dlls/msvcp140_atomic_wait/tests/msvcp140_atomic_wait.c b/dlls/msvcp140_atomic_wait/tests/msvcp140_atomic_wait.c index 0fd7058e099..20af783a6e2 100644 --- a/dlls/msvcp140_atomic_wait/tests/msvcp140_atomic_wait.c +++ b/dlls/msvcp140_atomic_wait/tests/msvcp140_atomic_wait.c @@ -24,6 +24,7 @@ static unsigned int (__stdcall *p___std_parallel_algorithms_hw_threads)(void); +static void (__stdcall *p___std_close_threadpool_work)(PTP_WORK); static PTP_WORK (__stdcall *p___std_create_threadpool_work)(PTP_WORK_CALLBACK, void*, PTP_CALLBACK_ENVIRON); static void (__stdcall *p___std_submit_threadpool_work)(PTP_WORK); static void (__stdcall *p___std_wait_for_threadpool_work_callbacks)(PTP_WORK, BOOL); @@ -39,6 +40,7 @@ static HMODULE init(void) SET(p___std_parallel_algorithms_hw_threads, "__std_parallel_algorithms_hw_threads"); + SET(p___std_close_threadpool_work, "__std_close_threadpool_work"); SET(p___std_create_threadpool_work, "__std_create_threadpool_work"); SET(p___std_submit_threadpool_work, "__std_submit_threadpool_work"); SET(p___std_wait_for_threadpool_work_callbacks, "__std_wait_for_threadpool_work_callbacks"); @@ -87,6 +89,7 @@ static void test_threadpool_work(void) p___std_create_threadpool_work(NULL, NULL, NULL); p___std_submit_threadpool_work(NULL); p___std_wait_for_threadpool_work_callbacks(NULL, FALSE); + p___std_close_threadpool_work(NULL); } /* simple test */ @@ -95,7 +98,7 @@ static void test_threadpool_work(void) ok(!!work, "failed to create threadpool_work\n"); p___std_submit_threadpool_work(work); p___std_wait_for_threadpool_work_callbacks(work, FALSE); - CloseThreadpoolWork(work); + p___std_close_threadpool_work(work); ok(workcalled == 1, "expected work to be called once, got %d\n", workcalled); ok(cb_work == work, "expected %p, got %p\n", work, cb_work); ok(cb_context == &workcalled, "expected %p, got %p\n", &workcalled, cb_context); @@ -110,7 +113,7 @@ static void test_threadpool_work(void) ok(!!work, "failed to create threadpool_work\n"); p___std_submit_threadpool_work(work); p___std_wait_for_threadpool_work_callbacks(work, FALSE); - CloseThreadpoolWork(work); + p___std_close_threadpool_work(work); ret = WaitForSingleObject(cb_event, 1000); ok(ret == WAIT_OBJECT_0, "expected finalization callback to be called\n"); ok(workcalled == 2, "expected work to be called twice, got %d\n", workcalled); @@ -126,7 +129,7 @@ static void test_threadpool_work(void) gle = GetLastError(); ok(gle == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", gle); ok(!!work, "failed to create threadpool_work\n"); - CloseThreadpoolWork(work); + p___std_close_threadpool_work(work); memset(&environment3, 0, sizeof(environment3)); environment3.Version = 3; -- 2.34.1