Daniel Lehman : msvcp140_atomic_wait: Implement __std_close_threadpool_work.

Alexandre Julliard julliard at winehq.org
Fri Jan 28 14:29:33 CST 2022


Module: wine
Branch: master
Commit: 69debac78681812b7dff36b9056ef6cd375e387b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=69debac78681812b7dff36b9056ef6cd375e387b

Author: Daniel Lehman <dlehman at esri.com>
Date:   Fri Jan 28 16:19:11 2022 +0100

msvcp140_atomic_wait: Implement __std_close_threadpool_work.

Signed-off-by: Daniel Lehman <dlehman at esri.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 a7ba1dc76ea..f67270fe3b5 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;




More information about the wine-cvs mailing list