Daniel Lehman : msvcr110: Add Concurrency::details::_GetConcurrency.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 29 15:40:46 CDT 2015


Module: wine
Branch: master
Commit: a7c7bc9180f8ac6e4f1ef9d7a9f53d4eaa5a4e24
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a7c7bc9180f8ac6e4f1ef9d7a9f53d4eaa5a4e24

Author: Daniel Lehman <dlehman at esri.com>
Date:   Fri Jul 24 00:13:19 2015 -0700

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 3faca07..51eddfb 100644
--- a/dlls/msvcr110/msvcr110.spec
+++ b/dlls/msvcr110/msvcr110.spec
@@ -533,7 +533,7 @@
 @ stub ?_Get at _CurrentScheduler@details at Concurrency@@SA?AV_Scheduler at 23@XZ
 @ stub -arch=win32 ?_GetConcRTTraceInfo at Concurrency@@YAPBU_CONCRT_TRACE_INFO at details@1 at XZ
 @ stub -arch=win64 ?_GetConcRTTraceInfo at Concurrency@@YAPEBU_CONCRT_TRACE_INFO at details@1 at XZ
-@ stub ?_GetConcurrency at details@Concurrency@@YAIXZ
+@ cdecl ?_GetConcurrency at details@Concurrency@@YAIXZ() _GetConcurrency
 @ stub -arch=win32 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAAIXZ
 @ stub -arch=win64 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAEA_KXZ
 @ stub ?_GetNumberOfVirtualProcessors at _CurrentScheduler@details at Concurrency@@SAIXZ
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index 5077a67..c2aacac 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -524,7 +524,7 @@
 @ stub ?_Get at _CurrentScheduler@details at Concurrency@@SA?AV_Scheduler at 23@XZ
 @ stub -arch=win32 ?_GetConcRTTraceInfo at Concurrency@@YAPBU_CONCRT_TRACE_INFO at details@1 at XZ
 @ stub -arch=win64 ?_GetConcRTTraceInfo at Concurrency@@YAPEBU_CONCRT_TRACE_INFO at details@1 at XZ
-@ stub ?_GetConcurrency at details@Concurrency@@YAIXZ
+@ cdecl ?_GetConcurrency at details@Concurrency@@YAIXZ() _GetConcurrency
 @ stub -arch=win32 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAAIXZ
 @ stub -arch=win64 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAEA_KXZ
 @ stub ?_GetNumberOfVirtualProcessors at _CurrentScheduler@details at Concurrency@@SAIXZ
diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c
index d334b51..330c6b1 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 at 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 3ff423d..392c3f7 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -522,7 +522,7 @@
 @ stub ?_Get at _CurrentScheduler@details at Concurrency@@SA?AV_Scheduler at 23@XZ
 @ stub -arch=win32 ?_GetConcRTTraceInfo at Concurrency@@YAPBU_CONCRT_TRACE_INFO at details@1 at XZ
 @ stub -arch=win64 ?_GetConcRTTraceInfo at Concurrency@@YAPEBU_CONCRT_TRACE_INFO at details@1 at XZ
-@ stub ?_GetConcurrency at details@Concurrency@@YAIXZ
+@ cdecl ?_GetConcurrency at details@Concurrency@@YAIXZ() msvcr120.?_GetConcurrency at details@Concurrency@@YAIXZ
 @ stub -arch=win32 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAAIXZ
 @ stub -arch=win64 ?_GetCurrentInlineDepth at _StackGuard@details at Concurrency@@CAAEA_KXZ
 @ stub ?_GetNumberOfVirtualProcessors at _CurrentScheduler@details at Concurrency@@SAIXZ
diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c
index 6d903dc..e69e1b9 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 at 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
 
 /**********************************************************************




More information about the wine-cvs mailing list