Daniel Lehman : msvcr110: Create current scheduler in _CurrentScheduler:: _Id.
Alexandre Julliard
julliard at winehq.org
Thu Jul 19 16:47:57 CDT 2018
Module: wine
Branch: master
Commit: 05f9db7b95ca0919c579957549e2d8dbaa468cd5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=05f9db7b95ca0919c579957549e2d8dbaa468cd5
Author: Daniel Lehman <dlehman at esri.com>
Date: Wed Jul 18 07:15:45 2018 -0700
msvcr110: Create current scheduler in _CurrentScheduler::_Id.
Signed-off-by: Daniel Lehman <dlehman at esri.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcr110/tests/msvcr110.c | 15 +++++++++++++++
dlls/msvcrt/scheduler.c | 1 +
2 files changed, 16 insertions(+)
diff --git a/dlls/msvcr110/tests/msvcr110.c b/dlls/msvcr110/tests/msvcr110.c
index 4b0043b..dcee5c1 100644
--- a/dlls/msvcr110/tests/msvcr110.c
+++ b/dlls/msvcr110/tests/msvcr110.c
@@ -35,6 +35,8 @@ static char* (CDECL *p_setlocale)(int category, const char* locale);
static unsigned int (CDECL *p_CurrentScheduler_GetNumberOfVirtualProcessors)(void);
static unsigned int (CDECL *p__CurrentScheduler__GetNumberOfVirtualProcessors)(void);
+static unsigned int (CDECL *p_CurrentScheduler_Id)(void);
+static unsigned int (CDECL *p__CurrentScheduler__Id)(void);
static BOOL init(void)
{
@@ -50,12 +52,15 @@ static BOOL init(void)
p_setlocale = (void*)GetProcAddress(module, "setlocale");
p_CurrentScheduler_GetNumberOfVirtualProcessors = (void*)GetProcAddress(module, "?GetNumberOfVirtualProcessors at CurrentScheduler@Concurrency@@SAIXZ");
p__CurrentScheduler__GetNumberOfVirtualProcessors = (void*)GetProcAddress(module, "?_GetNumberOfVirtualProcessors at _CurrentScheduler@details at Concurrency@@SAIXZ");
+ p_CurrentScheduler_Id = (void*)GetProcAddress(module, "?Id at CurrentScheduler@Concurrency@@SAIXZ");
+ p__CurrentScheduler__Id = (void*)GetProcAddress(module, "?_Id at _CurrentScheduler@details at Concurrency@@SAIXZ");
return TRUE;
}
static void test_CurrentScheduler(void)
{
+ unsigned int id;
unsigned int ncpus;
unsigned int expect;
SYSTEM_INFO si;
@@ -63,13 +68,23 @@ static void test_CurrentScheduler(void)
expect = ~0;
ncpus = p_CurrentScheduler_GetNumberOfVirtualProcessors();
ok(ncpus == expect, "expected %x, got %x\n", expect, ncpus);
+ id = p_CurrentScheduler_Id();
+ ok(id == expect, "expected %u, got %u\n", expect, id);
GetSystemInfo(&si);
expect = si.dwNumberOfProcessors;
+ /* these _CurrentScheduler calls trigger scheduler creation
+ if either is commented out, the following CurrentScheduler (no _) tests will still work */
ncpus = p__CurrentScheduler__GetNumberOfVirtualProcessors();
+ id = p__CurrentScheduler__Id();
ok(ncpus == expect, "expected %u, got %u\n", expect, ncpus);
+ ok(id == 0, "expected 0, got %u\n", id);
+
+ /* these CurrentScheduler tests assume scheduler is created */
ncpus = p_CurrentScheduler_GetNumberOfVirtualProcessors();
ok(ncpus == expect, "expected %u, got %u\n", expect, ncpus);
+ id = p_CurrentScheduler_Id();
+ ok(id == 0, "expected 0, got %u\n", id);
}
static void test_setlocale(void)
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index 6269c98..c6c0fa7 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -1071,6 +1071,7 @@ unsigned int __cdecl _CurrentScheduler__GetNumberOfVirtualProcessors(void)
unsigned int __cdecl _CurrentScheduler__Id(void)
{
TRACE("()\n");
+ get_current_scheduler();
return CurrentScheduler_Id();
}
More information about the wine-cvs
mailing list