Piotr Caban : msvcrt: Add CurrentScheduler:: GetNumberOfVirtualProcessors implementation.
Alexandre Julliard
julliard at winehq.org
Mon Apr 3 14:01:48 CDT 2017
Module: wine
Branch: master
Commit: 2d4be5cb35616552eb96cbf42996642c78626c5d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d4be5cb35616552eb96cbf42996642c78626c5d
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Apr 3 15:05:42 2017 +0200
msvcrt: Add CurrentScheduler::GetNumberOfVirtualProcessors implementation.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/scheduler.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index b5dc2f8..ff5cf6f 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -116,6 +116,7 @@ typedef struct Scheduler {
const vtable_ptr *vtable;
} Scheduler;
#define call_Scheduler_Id(this) CALL_VTBL_FUNC(this, 4, unsigned int, (const Scheduler*), (this))
+#define call_Scheduler_GetNumberOfVirtualProcessors(this) CALL_VTBL_FUNC(this, 8, unsigned int, (const Scheduler*), (this))
#define call_Scheduler_Reference(this) CALL_VTBL_FUNC(this, 16, unsigned int, (Scheduler*), (this))
#define call_Scheduler_Release(this) CALL_VTBL_FUNC(this, 20, unsigned int, (Scheduler*), (this))
#define call_Scheduler_Attach(this) CALL_VTBL_FUNC(this, 28, void, (Scheduler*), (this))
@@ -181,6 +182,20 @@ static Context* get_current_context(void)
return ret;
}
+static Scheduler* try_get_current_scheduler(void)
+{
+ ExternalContextBase *context = (ExternalContextBase*)try_get_current_context();
+
+ if (!context)
+ return NULL;
+
+ if (context->context.vtable != &MSVCRT_ExternalContextBase_vtable) {
+ ERR("unknown context set\n");
+ return NULL;
+ }
+ return context->scheduler.scheduler;
+}
+
/* ?CurrentContext at Context@Concurrency@@SAPAV12 at XZ */
/* ?CurrentContext at Context@Concurrency@@SAPEAV12 at XZ */
Context* __cdecl Context_CurrentContext(void)
@@ -240,7 +255,7 @@ unsigned int __cdecl Context_ScheduleGroupId(void)
unsigned int __cdecl Context_VirtualProcessorId(void)
{
Context *ctx = try_get_current_context();
- FIXME("()\n");
+ TRACE("()\n");
return ctx ? call_Context_GetVirtualProcessorId(ctx) : -1;
}
@@ -889,8 +904,11 @@ Scheduler* __cdecl CurrentScheduler_Get(void)
/* ?GetNumberOfVirtualProcessors at CurrentScheduler@Concurrency@@SAIXZ */
unsigned int __cdecl CurrentScheduler_GetNumberOfVirtualProcessors(void)
{
- FIXME("() stub\n");
- return 0;
+ Scheduler *scheduler = try_get_current_scheduler();
+ TRACE("()\n");
+ if(!scheduler)
+ return -1;
+ return call_Scheduler_GetNumberOfVirtualProcessors(scheduler);
}
/* ?GetPolicy at CurrentScheduler@Concurrency@@SA?AVSchedulerPolicy at 2@XZ */
More information about the wine-cvs
mailing list