Piotr Caban : msvcrt: Improve CurrentScheduler::Get implementation.
Alexandre Julliard
julliard at winehq.org
Mon Apr 3 14:01:48 CDT 2017
Module: wine
Branch: master
Commit: 6ad1e9a95414534694f66a7fd751e91ab9c18a03
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6ad1e9a95414534694f66a7fd751e91ab9c18a03
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Apr 3 15:05:49 2017 +0200
msvcrt: Improve CurrentScheduler::Get implementation.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/scheduler.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index ff5cf6f..b405f39 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -196,6 +196,17 @@ static Scheduler* try_get_current_scheduler(void)
return context->scheduler.scheduler;
}
+static Scheduler* get_current_scheduler(void)
+{
+ ExternalContextBase *context = (ExternalContextBase*)get_current_context();
+
+ 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)
@@ -867,22 +878,8 @@ static void create_default_scheduler(void)
/* ?Get at CurrentScheduler@Concurrency@@SAPEAVScheduler at 2@XZ */
Scheduler* __cdecl CurrentScheduler_Get(void)
{
- ExternalContextBase *context = (ExternalContextBase*)get_current_context();
-
TRACE("()\n");
-
- if(context->context.vtable != &MSVCRT_ExternalContextBase_vtable) {
- ERR("unknown context set\n");
- return NULL;
- }
-
- if(context->scheduler.scheduler)
- return context->scheduler.scheduler;
-
- create_default_scheduler();
- context->scheduler.scheduler = &default_scheduler->scheduler;
- call_Scheduler_Reference(&default_scheduler->scheduler);
- return &default_scheduler->scheduler;
+ return get_current_scheduler();
}
/* ?CreateScheduleGroup at CurrentScheduler@Concurrency@@SAPAVScheduleGroup at 2@AAVlocation at 2@@Z */
More information about the wine-cvs
mailing list