fune/third_party/rust/audio_thread_priority
Yannis Juglaret 3a457a3dde Bug 1885501 - Update audio_thread_priority to 0.32. r=padenot,cubeb-reviewers,supply-chain-reviewers
Version 0.32 of audio_thread_priority no longer links statically with
avrt.dll, which should help with the crash from bug 1884214.

Differential Revision: https://phabricator.services.mozilla.com/D204747
2024-03-18 12:20:25 +00:00
..
src Bug 1885501 - Update audio_thread_priority to 0.32. r=padenot,cubeb-reviewers,supply-chain-reviewers 2024-03-18 12:20:25 +00:00
.cargo-checksum.json Bug 1885501 - Update audio_thread_priority to 0.32. r=padenot,cubeb-reviewers,supply-chain-reviewers 2024-03-18 12:20:25 +00:00
atp_test.cpp
audio_thread_priority.h
Cargo.toml Bug 1885501 - Update audio_thread_priority to 0.32. r=padenot,cubeb-reviewers,supply-chain-reviewers 2024-03-18 12:20:25 +00:00
generate_osx_bindings.sh
LICENSE
Makefile
README.md

audio_thread_priority

Synopsis:


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