msvcp140_atomic_wait: Implement __std_submit_threadpool_work.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2022-01-28 16:18:58 +01:00 committed by Alexandre Julliard
parent f1e995f020
commit 68ad71a072
3 changed files with 12 additions and 3 deletions

View File

@ -37,3 +37,9 @@ PTP_WORK __stdcall __std_create_threadpool_work(PTP_WORK_CALLBACK callback, void
TRACE("(%p %p %p)\n", callback, context, environ); TRACE("(%p %p %p)\n", callback, context, environ);
return CreateThreadpoolWork(callback, context, environ); return CreateThreadpoolWork(callback, context, environ);
} }
void __stdcall __std_submit_threadpool_work(PTP_WORK work)
{
TRACE("(%p)\n", work);
return SubmitThreadpoolWork(work);
}

View File

@ -20,7 +20,7 @@
@ stub __std_free_crt @ stub __std_free_crt
@ stdcall __std_parallel_algorithms_hw_threads() @ stdcall __std_parallel_algorithms_hw_threads()
@ stub __std_release_shared_mutex_for_instance @ stub __std_release_shared_mutex_for_instance
@ stub __std_submit_threadpool_work @ stdcall __std_submit_threadpool_work(ptr)
@ stub __std_tzdb_delete_current_zone @ stub __std_tzdb_delete_current_zone
@ stub __std_tzdb_delete_leap_seconds @ stub __std_tzdb_delete_leap_seconds
@ stub __std_tzdb_delete_sys_info @ stub __std_tzdb_delete_sys_info

View File

@ -25,6 +25,7 @@
static unsigned int (__stdcall *p___std_parallel_algorithms_hw_threads)(void); static unsigned int (__stdcall *p___std_parallel_algorithms_hw_threads)(void);
static PTP_WORK (__stdcall *p___std_create_threadpool_work)(PTP_WORK_CALLBACK, void*, PTP_CALLBACK_ENVIRON); 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);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0) #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
@ -38,6 +39,7 @@ static HMODULE init(void)
SET(p___std_parallel_algorithms_hw_threads, "__std_parallel_algorithms_hw_threads"); SET(p___std_parallel_algorithms_hw_threads, "__std_parallel_algorithms_hw_threads");
SET(p___std_create_threadpool_work, "__std_create_threadpool_work"); SET(p___std_create_threadpool_work, "__std_create_threadpool_work");
SET(p___std_submit_threadpool_work, "__std_submit_threadpool_work");
return msvcp; return msvcp;
} }
@ -81,13 +83,14 @@ static void test_threadpool_work(void)
if (0) /* crash on windows */ if (0) /* crash on windows */
{ {
p___std_create_threadpool_work(NULL, NULL, NULL); p___std_create_threadpool_work(NULL, NULL, NULL);
p___std_submit_threadpool_work(NULL);
} }
/* simple test */ /* simple test */
workcalled = 0; workcalled = 0;
work = p___std_create_threadpool_work(threadpool_workcallback, &workcalled, NULL); work = p___std_create_threadpool_work(threadpool_workcallback, &workcalled, NULL);
ok(!!work, "failed to create threadpool_work\n"); ok(!!work, "failed to create threadpool_work\n");
SubmitThreadpoolWork(work); p___std_submit_threadpool_work(work);
WaitForThreadpoolWorkCallbacks(work, FALSE); WaitForThreadpoolWorkCallbacks(work, FALSE);
CloseThreadpoolWork(work); CloseThreadpoolWork(work);
ok(workcalled == 1, "expected work to be called once, got %d\n", workcalled); ok(workcalled == 1, "expected work to be called once, got %d\n", workcalled);
@ -102,7 +105,7 @@ static void test_threadpool_work(void)
workcalled = 0; workcalled = 0;
work = p___std_create_threadpool_work(threadpool_workcallback, &workcalled, &environment); work = p___std_create_threadpool_work(threadpool_workcallback, &workcalled, &environment);
ok(!!work, "failed to create threadpool_work\n"); ok(!!work, "failed to create threadpool_work\n");
SubmitThreadpoolWork(work); p___std_submit_threadpool_work(work);
WaitForThreadpoolWorkCallbacks(work, FALSE); WaitForThreadpoolWorkCallbacks(work, FALSE);
CloseThreadpoolWork(work); CloseThreadpoolWork(work);
ret = WaitForSingleObject(cb_event, 1000); ret = WaitForSingleObject(cb_event, 1000);