Commit 05f9db7b authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcr110: Create current scheduler in _CurrentScheduler::_Id.

parent 5757c2c8
......@@ -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@CurrentScheduler@Concurrency@@SAIXZ");
p__CurrentScheduler__GetNumberOfVirtualProcessors = (void*)GetProcAddress(module, "?_GetNumberOfVirtualProcessors@_CurrentScheduler@details@Concurrency@@SAIXZ");
p_CurrentScheduler_Id = (void*)GetProcAddress(module, "?Id@CurrentScheduler@Concurrency@@SAIXZ");
p__CurrentScheduler__Id = (void*)GetProcAddress(module, "?_Id@_CurrentScheduler@details@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)
......
......@@ -1071,6 +1071,7 @@ unsigned int __cdecl _CurrentScheduler__GetNumberOfVirtualProcessors(void)
unsigned int __cdecl _CurrentScheduler__Id(void)
{
TRACE("()\n");
get_current_scheduler();
return CurrentScheduler_Id();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment