Previous: Hand-Off Scheduling, Up: Scheduling
The function
thread_policychanges the scheduling policy for thread to policy.data is policy-dependent scheduling information. There are currently two supported policies:
POLICY_TIMESHAREandPOLICY_FIXEDPRIdefined in mach/policy.h; this file is included by mach.h. data is meaningless for timesharing, but is the quantum to be used (in milliseconds) for the fixed priority policy. To be meaningful, this quantum must be a multiple of the basic system quantum (min_quantum) which can be obtained fromhost_info. The system will always round up to the next multiple of the quantum.Processor sets may restrict the allowed policies, so this call will fail if the processor set to which thread is currently assigned does not permit policy.
The function returns
KERN_SUCCESSif the call succeeded.KERN_INVALID_ARGUMENTif thread is not a thread or policy is not a recognized policy, andKERN_FAILUREif the processor set to which thread is currently assigned does not permit policy.