Piotr Caban : msvcrt: Add ThreadScheduler::GetPolicy implementation.

Alexandre Julliard julliard at winehq.org
Tue Mar 28 15:38:41 CDT 2017


Module: wine
Branch: master
Commit: 5debf060b8cba0639694f4a8088b2b72b4561f60
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5debf060b8cba0639694f4a8088b2b72b4561f60

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Mar 28 10:50:32 2017 +0200

msvcrt: Add ThreadScheduler::GetPolicy implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/scheduler.c | 47 +++++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index a1fd8ba..1c9a770 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -52,6 +52,26 @@ DEFINE_VTBL_WRAPPER(20);
 
 #endif
 
+typedef enum {
+    SchedulerKind,
+    MaxConcurrency,
+    MinConcurrency,
+    TargetOversubscriptionFactor,
+    LocalContextCacheSize,
+    ContextStackSize,
+    ContextPriority,
+    SchedulingProtocol,
+    DynamicProgressFeedback,
+    WinRTInitialization,
+    last_policy_id
+} PolicyElementKey;
+
+typedef struct {
+    struct _policy_container {
+        unsigned int policies[last_policy_id];
+    } *policy_container;
+} SchedulerPolicy;
+
 typedef struct {
     const vtable_ptr *vtable;
 } Context;
@@ -89,6 +109,7 @@ typedef struct {
 
 typedef struct {
     Scheduler scheduler;
+    SchedulerPolicy policy;
 } ThreadScheduler;
 extern const vtable_ptr MSVCRT_ThreadScheduler_vtable;
 
@@ -329,26 +350,6 @@ void CDECL Concurrency_Free(void* mem)
     }
 }
 
-typedef enum {
-    SchedulerKind,
-    MaxConcurrency,
-    MinConcurrency,
-    TargetOversubscriptionFactor,
-    LocalContextCacheSize,
-    ContextStackSize,
-    ContextPriority,
-    SchedulingProtocol,
-    DynamicProgressFeedback,
-    WinRTInitialization,
-    last_policy_id
-} PolicyElementKey;
-
-typedef struct {
-    struct _policy_container {
-        unsigned int policies[last_policy_id];
-    } *policy_container;
-} SchedulerPolicy;
-
 /* ?SetPolicyValue at SchedulerPolicy@Concurrency@@QAEIW4PolicyElementKey at 2@I at Z */
 /* ?SetPolicyValue at SchedulerPolicy@Concurrency@@QEAAIW4PolicyElementKey at 2@I at Z */
 DEFINE_THISCALL_WRAPPER(SchedulerPolicy_SetPolicyValue, 12)
@@ -533,8 +534,8 @@ DEFINE_THISCALL_WRAPPER(ThreadScheduler_GetPolicy, 8)
 SchedulerPolicy* __thiscall ThreadScheduler_GetPolicy(
         const ThreadScheduler *this, SchedulerPolicy *ret)
 {
-    FIXME("(%p %p) stub\n", this, ret);
-    return NULL;
+    TRACE("(%p %p)\n", this, ret);
+    return SchedulerPolicy_copy_ctor(ret, &this->policy);
 }
 
 DEFINE_THISCALL_WRAPPER(ThreadScheduler_Reference, 4)
@@ -602,6 +603,7 @@ MSVCRT_bool __thiscall ThreadScheduler_IsAvailableLocation(
 
 static void ThreadScheduler_dtor(ThreadScheduler *this)
 {
+    SchedulerPolicy_dtor(&this->policy);
 }
 
 DEFINE_THISCALL_WRAPPER(ThreadScheduler_vector_dtor, 8)
@@ -630,6 +632,7 @@ static ThreadScheduler* ThreadScheduler_ctor(ThreadScheduler *this,
     TRACE("(%p)->()\n", this);
 
     this->scheduler.vtable = &MSVCRT_ThreadScheduler_vtable;
+    SchedulerPolicy_copy_ctor(&this->policy, policy);
     return this;
 }
 




More information about the wine-cvs mailing list