Expand description

audio_thread_priority

Promote the current thread, or another thread (possibly in another process), to real-time priority, suitable for low-latency audio processing.

Example


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);
  }
}

Structs

The OS-specific issue is available as inner

Opaque handle for the C API

Opaque info to a particular thread.

Statics

Size of a RtPriorityThreadInfo or atp_thread_info struct, for use in FFI.

Functions

Demotes the calling thread from real-time priority, with a C API.

Demote a thread promoted to from real-time, with a C API.

From a byte buffer, return a RtPriorityThreadInfo, with a C API.

Frees a handle, with a C API.

Frees a thread info, with a c api.

Get the calling threads’ information, to promote it from another process or thread, with a C API.

Promote the calling thread thread to real-time priority, with a C API.

Promote a specific thread to real-time, with a C API.

Return a byte buffer containing serialized information about a thread, to promote it to real-time from elsewhere, with a C API.

Set a real-time limit for the calling thread.

Demotes the calling thread from real-time priority.

Demotes a thread from real-time priority.

Get the calling thread’s information, to be able to promote it to real-time from somewhere else, later.

Promote the calling thread thread to real-time priority.

Promote a particular thread thread to real-time priority.

From a byte buffer, return a RtPriorityThreadInfo.

Return a byte buffer containing serialized information about a thread, to promote it to real-time from elsewhere.

Type Definitions

Opaque handle to a thread handle structure.

Opaque handle to a thread info.