From 04bb658f0a054b3f3d2fa2e5125166d99e4d10c3 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Thu, 26 May 2016 21:36:07 -0700 Subject: [PATCH] msvcp140: Implement _Thrd_hardware_concurrency. Signed-off-by: Daniel Lehman Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp90/misc.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index 922aa9ea6f5..05d62becb12 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3725,7 +3725,7 @@ @ cdecl _Thrd_detach(ptr) msvcp110._Thrd_detach @ cdecl _Thrd_equal(ptr ptr) _Thrd_equal @ stub _Thrd_exit -@ stub _Thrd_hardware_concurrency +@ cdecl _Thrd_hardware_concurrency() _Thrd_hardware_concurrency @ stub _Thrd_id @ cdecl _Thrd_join(ptr long) _Thrd_join @ cdecl _Thrd_sleep(ptr) _Thrd_sleep diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 2037e699d3c..52bc608337a 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -942,6 +942,22 @@ DEFINE_RTTI_DATA0(_Pad, 0, ".?AV_Pad@std@@") /* ??_7_Pad@std@@6B@ */ extern const vtable_ptr MSVCP__Pad_vtable; +unsigned int __cdecl _Thrd_hardware_concurrency(void) +{ + static unsigned int val = -1; + + TRACE("()\n"); + + if(val == -1) { + SYSTEM_INFO si; + + GetSystemInfo(&si); + val = si.dwNumberOfProcessors; + } + + return val; +} + /* ??0_Pad@std@@QAE@XZ */ /* ??0_Pad@std@@QEAA@XZ */ DEFINE_THISCALL_WRAPPER(_Pad_ctor, 4)