https://github.com/hinto-janai/lpt
Low priority thread
https://github.com/hinto-janai/lpt
low priority rust thread
Last synced: 10 months ago
JSON representation
Low priority thread
- Host: GitHub
- URL: https://github.com/hinto-janai/lpt
- Owner: hinto-janai
- License: mit
- Created: 2023-10-29T17:33:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-29T17:56:56.000Z (over 2 years ago)
- Last Synced: 2025-06-21T21:02:20.387Z (10 months ago)
- Topics: low, priority, rust, thread
- Language: Rust
- Homepage: https://docs.rs/lpt
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Low Priority Thread
 [](https://crates.io/crates/lpt) [](https://docs.rs/lpt)
This is a 1-function crate that sets the calling thread's priority to the lowest platform-specific value possible.
```rust
// Set the current thread to the lowest priority.
//
// This function returns () and will never fail.
lpt::lpt();
```
## Windows
Uses [`SetThreadPriority()`](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadpriority) with `THREAD_PRIORITY_IDLE` (`-15`).
## Unix
Uses [`libc::nice()`](https://man7.org/linux/man-pages/man2/nice.2.html) with the max nice level.
- On `macOS` and `*BSD`: `+20`
- On `Linux`: `+19`