Struct sqa_engine::sync::AudioThreadHandle
[−]
[src]
pub struct AudioThreadHandle { /* fields omitted */ }
A commmunication channel to receive messages from the audio thread.
Methods
impl AudioThreadHandle
[src]
unsafe fn make() -> (AudioThreadHandle, AudioThreadSender)
This function MUST NOT be used by consumers of the library. It's just here because I can't help it.
fn try_recv(&mut self) -> Option<AudioThreadMessage>
Attempt to receive a message from the audio thread, returning None
if none is available.
fn recv(&mut self) -> AudioThreadMessage
Wait (forever, if necessary) until a message is available, and return it.
This blocks the thread on a condition variable, consuming no CPU time whilst blocked.
fn wait_until(&mut self, timeout: Instant) -> Option<AudioThreadMessage>
Wait until a message is available, timing out after the specified time instant. Return a
message if obtained in the time period, otherwise None
.
The semantics of this function are equivalent to recv()
except that the thread will be
blocked roughly until the timeout is reached. This method should not be used for precise timing
due to anomalies such as preemption or platform differences that may not cause the maximum
amount of time waited to be precisely the value given.
Note that the best effort is made to ensure that the time waited is measured with a monotonic clock, and not affected by the changes made to the system time.
fn wait_for(&mut self, timeout: Duration) -> Option<AudioThreadMessage>
Wait until a message is available, timing out after a specified duration. Return a
message if obtained in the time period, otherwise None
.
The semantics of this function are equivalent to recv()
except that the thread will be
blocked for roughly no longer than timeout
. This method should not be used for precise
timing due to anomalies such as preemption or platform differences that may not cause the
maximum amount of time waited to be precisely timeout
.
Note that the best effort is made to ensure that the time waited is measured with a monotonic clock, and not affected by the changes made to the system time.