From 1b4e1db078b75e9a4c5ed37e9a9fe62557ea204c 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 --- 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 1ae940d..c0571de 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 68ff45a..2b6af31 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -972,6 +972,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) -- 1.9.5