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§
- Audio
Thread Priority Error - The OS-specific issue is available as
inner
- atp_
handle - Opaque handle for the C API
- atp_
thread_ info - Opaque info to a particular thread.
Statics§
- ATP_
THREAD_ INFO_ SIZE - Size of a RtPriorityThreadInfo or atp_thread_info struct, for use in FFI.
Functions§
- atp_
demote_ ⚠current_ thread_ from_ real_ time - Demotes the calling thread from real-time priority, with a C API.
- atp_
demote_ ⚠thread_ from_ real_ time - Demote a thread promoted to from real-time, with a C API.
- atp_
deserialize_ ⚠thread_ info - From a byte buffer, return a
RtPriorityThreadInfo
, with a C API. - atp_
free_ ⚠handle - Frees a handle, with a C API.
- atp_
free_ ⚠thread_ info - Frees a thread info, with a c api.
- atp_
get_ current_ thread_ info - Get the calling threads’ information, to promote it from another process or thread, with a C API.
- atp_
promote_ current_ thread_ to_ real_ time - Promote the calling thread thread to real-time priority, with a C API.
- atp_
promote_ ⚠thread_ to_ real_ time - Promote a specific thread to real-time, with a C API.
- atp_
serialize_ ⚠thread_ info - Return a byte buffer containing serialized information about a thread, to promote it to real-time from elsewhere, with a C API.
- atp_
set_ real_ time_ limit - Set a real-time limit for the calling thread.
- demote_
current_ thread_ from_ real_ time - Demotes the calling thread from real-time priority.
- demote_
thread_ from_ real_ time - Demotes a thread from real-time priority.
- get_
current_ thread_ info - Get the calling thread’s information, to be able to promote it to real-time from somewhere else, later.
- promote_
current_ thread_ to_ real_ time - Promote the calling thread thread to real-time priority.
- promote_
thread_ to_ real_ time - Promote a particular thread thread to real-time priority.
- thread_
info_ deserialize - From a byte buffer, return a
RtPriorityThreadInfo
. - thread_
info_ serialize - Return a byte buffer containing serialized information about a thread, to promote it to real-time from elsewhere.
Type Aliases§
- RtPriority
Handle - Opaque handle to a thread handle structure.
- RtPriority
Thread Info - Opaque handle to a thread info.