diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/rust/audio_thread_priority/README.md | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/audio_thread_priority/README.md')
-rw-r--r-- | third_party/rust/audio_thread_priority/README.md | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/third_party/rust/audio_thread_priority/README.md b/third_party/rust/audio_thread_priority/README.md new file mode 100644 index 0000000000..42bb3a02b3 --- /dev/null +++ b/third_party/rust/audio_thread_priority/README.md @@ -0,0 +1,43 @@ +# audio_thread_priority + +[![](https://img.shields.io/crates/v/audio_thread_priority.svg)](https://crates.io/crates/audio_thread_priority) +[![](https://docs.rs/audio_thread_priority/badge.svg)](https://docs.rs/audio_thread_priority) + + +Synopsis: + +```rust + +use audio_thread_priority::{promote_current_thread_to_real_time, demote_current_thread_from_real_time}; + +// ... on a thread that will compute audio and has to be real-time: +match promote_current_thread_to_real_time(512, 44100) { + Ok(h) => { + println!("this thread is now bumped to real-time priority."); + + // Do some real-time work... + + match demote_current_thread_from_real_time(h) { + Ok(_) => { + println!("this thread is now bumped back to normal.") + } + Err(_) => { + println!("Could not bring the thread back to normal priority.") + } + }; + } + Err(e) => { + eprintln!("Error promoting thread to real-time: {}", e); + } +} + +``` + +This library can also be used from C or C++ using the included header and +compiling the rust code in the application. By default, a `.a` is compiled to +ease linking. + +# License + +MPL-2 + |