From a7c7bc9180f8ac6e4f1ef9d7a9f53d4eaa5a4e24 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Fri, 24 Jul 2015 00:13:19 -0700 Subject: [PATCH] msvcr110: Add Concurrency::details::_GetConcurrency. --- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120/tests/msvcr120.c | 13 +++++++++++++ dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/lock.c | 18 ++++++++++++++++++ 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 3faca079659..51eddfbd422 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -533,7 +533,7 @@ @ stub ?_Get@_CurrentScheduler@details@Concurrency@@SA?AV_Scheduler@23@XZ @ stub -arch=win32 ?_GetConcRTTraceInfo@Concurrency@@YAPBU_CONCRT_TRACE_INFO@details@1@XZ @ stub -arch=win64 ?_GetConcRTTraceInfo@Concurrency@@YAPEBU_CONCRT_TRACE_INFO@details@1@XZ -@ stub ?_GetConcurrency@details@Concurrency@@YAIXZ +@ cdecl ?_GetConcurrency@details@Concurrency@@YAIXZ() _GetConcurrency @ stub -arch=win32 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAAIXZ @ stub -arch=win64 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAEA_KXZ @ stub ?_GetNumberOfVirtualProcessors@_CurrentScheduler@details@Concurrency@@SAIXZ diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 5077a6722e3..c2aacac3762 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -524,7 +524,7 @@ @ stub ?_Get@_CurrentScheduler@details@Concurrency@@SA?AV_Scheduler@23@XZ @ stub -arch=win32 ?_GetConcRTTraceInfo@Concurrency@@YAPBU_CONCRT_TRACE_INFO@details@1@XZ @ stub -arch=win64 ?_GetConcRTTraceInfo@Concurrency@@YAPEBU_CONCRT_TRACE_INFO@details@1@XZ -@ stub ?_GetConcurrency@details@Concurrency@@YAIXZ +@ cdecl ?_GetConcurrency@details@Concurrency@@YAIXZ() _GetConcurrency @ stub -arch=win32 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAAIXZ @ stub -arch=win64 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAEA_KXZ @ stub ?_GetNumberOfVirtualProcessors@_CurrentScheduler@details@Concurrency@@SAIXZ diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index d334b511705..330c6b17a68 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -64,6 +64,7 @@ static size_t (CDECL *p_wcstombs_s)(size_t *ret, char* dest, size_t sz, const wc static int (CDECL *p__dsign)(double); static int (CDECL *p__fdsign)(float); static wchar_t** (CDECL *p____lc_locale_name_func)(void); +static unsigned int (CDECL *p__GetConcurrency)(void); static BOOL init(void) { @@ -82,6 +83,7 @@ static BOOL init(void) p__dsign = (void*)GetProcAddress(module, "_dsign"); p__fdsign = (void*)GetProcAddress(module, "_fdsign"); p____lc_locale_name_func = (void*)GetProcAddress(module, "___lc_locale_name_func"); + p__GetConcurrency = (void*)GetProcAddress(module,"?_GetConcurrency@details@Concurrency@@YAIXZ"); return TRUE; } @@ -221,10 +223,21 @@ static void test____lc_locale_name_func(void) ok(!lc_names[1], "___lc_locale_name_func()[1] = %s\n", wine_dbgstr_w(lc_names[1])); } +static void test__GetConcurrency(void) +{ + SYSTEM_INFO si; + unsigned int c; + + GetSystemInfo(&si); + c = (*p__GetConcurrency)(); + ok(c == si.dwNumberOfProcessors, "expected %u, got %u\n", si.dwNumberOfProcessors, c); +} + START_TEST(msvcr120) { if (!init()) return; test_lconv(); test__dsign(); test____lc_locale_name_func(); + test__GetConcurrency(); } diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 3ff423d2468..392c3f7c7e9 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -522,7 +522,7 @@ @ stub ?_Get@_CurrentScheduler@details@Concurrency@@SA?AV_Scheduler@23@XZ @ stub -arch=win32 ?_GetConcRTTraceInfo@Concurrency@@YAPBU_CONCRT_TRACE_INFO@details@1@XZ @ stub -arch=win64 ?_GetConcRTTraceInfo@Concurrency@@YAPEBU_CONCRT_TRACE_INFO@details@1@XZ -@ stub ?_GetConcurrency@details@Concurrency@@YAIXZ +@ cdecl ?_GetConcurrency@details@Concurrency@@YAIXZ() msvcr120.?_GetConcurrency@details@Concurrency@@YAIXZ @ stub -arch=win32 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAAIXZ @ stub -arch=win64 ?_GetCurrentInlineDepth@_StackGuard@details@Concurrency@@CAAEA_KXZ @ stub ?_GetNumberOfVirtualProcessors@_CurrentScheduler@details@Concurrency@@SAIXZ diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c index 6d903dcff32..e69e1b9dd26 100644 --- a/dlls/msvcrt/lock.c +++ b/dlls/msvcrt/lock.c @@ -537,6 +537,24 @@ void __thiscall critical_section_scoped_lock_dtor(critical_section_scoped_lock * TRACE("(%p)\n", this); critical_section_unlock(this->cs); } + +/* ?_GetConcurrency@details@Concurrency@@YAIXZ */ +unsigned int __cdecl _GetConcurrency(void) +{ + static unsigned int val = -1; + + TRACE("()\n"); + + if(val == -1) { + SYSTEM_INFO si; + + GetSystemInfo(&si); + val = si.dwNumberOfProcessors; + } + + return val; +} + #endif /**********************************************************************