Function thread_priority::windows::set_thread_ideal_processor [−][src]
pub fn set_thread_ideal_processor(
native: ThreadId,
ideal_processor: IdealProcessor
) -> Result<IdealProcessor, Error>
Expand description
Sets a preferred processor for a thread. The system schedules threads on their preferred processors whenever possible.
On a system with more than 64 processors, this function sets the preferred processor to a
logical processor in the processor group to which the calling thread is assigned. Use the
SetThreadIdealProcessorEx
function to specify a processor group and preferred processor.
If there’s an error, a result of
GetLastError
is returned.
On success, the function returns a previously assigned processor.
Note
The processor number starts with zero.
Usage
use thread_priority::*; let thread_id = thread_native_id(); assert!(set_thread_ideal_processor(thread_id, 0).is_ok())