X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..060df5ea7c632b1ac8cc8aac1fb59758165c2084:/osfmk/kern/thread_policy.c?ds=inline diff --git a/osfmk/kern/thread_policy.c b/osfmk/kern/thread_policy.c index 45cd6ef24..58028df2d 100644 --- a/osfmk/kern/thread_policy.c +++ b/osfmk/kern/thread_policy.c @@ -38,6 +38,8 @@ static void thread_recompute_priority( thread_t thread); + + kern_return_t thread_policy_set( thread_t thread, @@ -45,25 +47,32 @@ thread_policy_set( thread_policy_t policy_info, mach_msg_type_number_t count) { - kern_return_t result = KERN_SUCCESS; - spl_t s; if (thread == THREAD_NULL) return (KERN_INVALID_ARGUMENT); + if (thread->static_param) + return (KERN_SUCCESS); + + return (thread_policy_set_internal(thread, flavor, policy_info, count)); +} + +kern_return_t +thread_policy_set_internal( + thread_t thread, + thread_policy_flavor_t flavor, + thread_policy_t policy_info, + mach_msg_type_number_t count) +{ + kern_return_t result = KERN_SUCCESS; + spl_t s; + thread_mtx_lock(thread); if (!thread->active) { thread_mtx_unlock(thread); return (KERN_TERMINATED); } - - if (thread->static_param) { - thread_mtx_unlock(thread); - - return (KERN_SUCCESS); - } - switch (flavor) { case THREAD_EXTENDED_POLICY: @@ -170,7 +179,6 @@ thread_policy_set( result = KERN_INVALID_ARGUMENT; break; } - info = (thread_precedence_policy_t)policy_info; s = splsched(); @@ -215,7 +223,6 @@ thread_policy_set( } thread_mtx_unlock(thread); - return (result); }