2 releases
0.1.1 | Jul 27, 2020 |
---|---|
0.1.0 | Jul 26, 2020 |
#767 in Concurrency
Used in wallrnd
14KB
219 lines
scrummage
Control the scheduling of your processes to make your programs more reponsive!
scrummage::Process::current()
.set_priority(scrummage::Priority::normal().lower().last().unwrap())
.expect("couldn't set own thread priority");
Roadmap
- Linux support
- ...then Unix,
- and MacOS?
- Windows support
- Thread prioritisation
- This is currently part of thread-priority
- and it's harder to get right; I'd like to protect users from Priority Inversion etc.
lib.rs
:
A thin abstraction over OS process scheduling APIs.
By signalling the priority of our processes to the operating system, we gain more control over our program's resource usage, and which tasks get completed first.
For example, we can configure our UI to preempt background tasks by giving it a higher priority:
let me = Process::current().priority().unwrap();
let boring_work = me.lower().next().expect("no lower priority available");
// It's fine if the `busy_child_process` has already finished
let _ = Process::from(&mut busy_child_process)
.set_priority(boring_work);
This will tell the OS to make sure me
is always given all the resources
it needs, making it snappier.
Dependencies
~44KB