From ac502ad05a17bed7488377601e102c087b90e13a Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 28 Mar 2017 10:50:43 +0200 Subject: [PATCH] msvcrt: Add ThreadScheduler::GetNumberOfVirtualProcessors implementation. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcrt/scheduler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c index 18e563668eb..f8afed09ffa 100644 --- a/dlls/msvcrt/scheduler.c +++ b/dlls/msvcrt/scheduler.c @@ -111,6 +111,7 @@ typedef struct { typedef struct { Scheduler scheduler; unsigned int id; + unsigned int virt_proc_no; SchedulerPolicy policy; } ThreadScheduler; extern const vtable_ptr MSVCRT_ThreadScheduler_vtable; @@ -528,8 +529,8 @@ unsigned int __thiscall ThreadScheduler_Id(const ThreadScheduler *this) DEFINE_THISCALL_WRAPPER(ThreadScheduler_GetNumberOfVirtualProcessors, 4) unsigned int __thiscall ThreadScheduler_GetNumberOfVirtualProcessors(const ThreadScheduler *this) { - FIXME("(%p) stub\n", this); - return 0; + TRACE("(%p)\n", this); + return this->virt_proc_no; } DEFINE_THISCALL_WRAPPER(ThreadScheduler_GetPolicy, 8) @@ -631,11 +632,18 @@ Scheduler* __thiscall ThreadScheduler_vector_dtor(ThreadScheduler *this, unsigne static ThreadScheduler* ThreadScheduler_ctor(ThreadScheduler *this, const SchedulerPolicy *policy) { + SYSTEM_INFO si; + TRACE("(%p)->()\n", this); this->scheduler.vtable = &MSVCRT_ThreadScheduler_vtable; this->id = InterlockedIncrement(&scheduler_id); SchedulerPolicy_copy_ctor(&this->policy, policy); + + GetSystemInfo(&si); + this->virt_proc_no = SchedulerPolicy_GetPolicyValue(&this->policy, MaxConcurrency); + if(this->virt_proc_no > si.dwNumberOfProcessors) + this->virt_proc_no = si.dwNumberOfProcessors; return this; }