thread-priority
A simple library to control thread schedule policies and thread priority.
This crate does not support all the plaforms yet but it is inteded to be developed so, so feel free to contribute!
Supported platforms
- Linux
- Windows
Examples
Minimal cross-platform examples
Setting current thread's priority to minimum:
use *;
The same as above but using a specific value:
use *;
use TryInto;
Windows-specific examples
Set the thread priority to the lowest possible value:
use *;
Set the ideal processor for the new thread:
use *;
Building a thread using the ThreadBuilderExt trait
use *;
use ThreadBuilderExt;
let thread = new
.name
.spawn_with_priority.unwrap;
thread.join;
Building a thread using the ThreadBuilder.
use *;
let thread = default
.name
.priority
.spawn.unwrap;
thread.join;
// Another example where we don't care about the priority having been set.
let thread = default
.name
.priority
.spawn_careless.unwrap;
thread.join;
Using ThreadExt trait on the current thread
use *;
assert!;
println!;
License
This project is licensed under the MIT license.