msvcr110: Create current scheduler in _CurrentScheduler::_Id.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2018-07-18 07:15:45 -07:00 committed by Alexandre Julliard
parent 5757c2c8c6
commit 05f9db7b95
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -1071,6 +1071,7 @@ unsigned int __cdecl _CurrentScheduler__GetNumberOfVirtualProcessors(void)
unsigned int __cdecl _CurrentScheduler__Id(void)
{
TRACE("()\n");
get_current_scheduler();
return CurrentScheduler_Id();
}