msvcp140_atomic_wait: Implement __std_parallel_algorithms_hw_threads.

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-26 17:24:35 +01:00 committed by Alexandre Julliard
parent d04e7f25c3
commit 2e88169d7b
7 changed files with 103 additions and 1 deletions

1
configure vendored
View File

@ -22132,6 +22132,7 @@ wine_fn_config_makefile dlls/msvcp140/tests enable_tests
wine_fn_config_makefile dlls/msvcp140_1 enable_msvcp140_1
wine_fn_config_makefile dlls/msvcp140_1/tests enable_tests
wine_fn_config_makefile dlls/msvcp140_atomic_wait enable_msvcp140_atomic_wait
wine_fn_config_makefile dlls/msvcp140_atomic_wait/tests enable_tests
wine_fn_config_makefile dlls/msvcp60 enable_msvcp60
wine_fn_config_makefile dlls/msvcp60/tests enable_tests
wine_fn_config_makefile dlls/msvcp70 enable_msvcp70

View File

@ -3056,6 +3056,7 @@ WINE_CONFIG_MAKEFILE(dlls/msvcp140/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcp140_1)
WINE_CONFIG_MAKEFILE(dlls/msvcp140_1/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcp140_atomic_wait)
WINE_CONFIG_MAKEFILE(dlls/msvcp140_atomic_wait/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcp60)
WINE_CONFIG_MAKEFILE(dlls/msvcp60/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcp70)

View File

@ -1 +1,5 @@
MODULE = msvcp140_atomic_wait.dll
IMPORTS = msvcp140
C_SRCS = \
main.c

View File

@ -0,0 +1,32 @@
/*
* Copyright 2022 Daniel Lehman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
extern unsigned int __cdecl _Thrd_hardware_concurrency(void);
unsigned int __stdcall __std_parallel_algorithms_hw_threads(void)
{
TRACE("()\n");
return _Thrd_hardware_concurrency();
}

View File

@ -18,7 +18,7 @@
@ stub __std_execution_wait_on_uchar
@ stub __std_execution_wake_by_address_all
@ stub __std_free_crt
@ stub __std_parallel_algorithms_hw_threads
@ stdcall __std_parallel_algorithms_hw_threads()
@ stub __std_release_shared_mutex_for_instance
@ stub __std_submit_threadpool_work
@ stub __std_tzdb_delete_current_zone

View File

@ -0,0 +1,4 @@
TESTDLL = msvcp140_atomic_wait.dll
C_SRCS = \
msvcp140_atomic_wait.c

View File

@ -0,0 +1,60 @@
/*
* Copyright 2022 Daniel Lehman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wine/test.h"
static unsigned int (__stdcall *p___std_parallel_algorithms_hw_threads)(void);
#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)
static HMODULE init(void)
{
HMODULE msvcp;
if (!(msvcp = LoadLibraryA("msvcp140_atomic_wait.dll")))
return NULL;
SET(p___std_parallel_algorithms_hw_threads, "__std_parallel_algorithms_hw_threads");
return msvcp;
}
static void test___std_parallel_algorithms_hw_threads(void)
{
SYSTEM_INFO si;
unsigned int nthr;
GetSystemInfo(&si);
nthr = p___std_parallel_algorithms_hw_threads();
ok(nthr == si.dwNumberOfProcessors, "expected %u, got %u\n", si.dwNumberOfProcessors, nthr);
}
START_TEST(msvcp140_atomic_wait)
{
HMODULE msvcp;
if (!(msvcp = init()))
{
win_skip("msvcp140_atomic_wait.dll not installed\n");
return;
}
test___std_parallel_algorithms_hw_threads();
FreeLibrary(msvcp);
}