pub struct ThreadLoopBox { /* private fields */ }
Implementations§
Source§impl ThreadLoopBox
impl ThreadLoopBox
Sourcepub unsafe fn new(
name: Option<&str>,
properties: Option<&DictRef>,
) -> Result<Self, Error>
pub unsafe fn new( name: Option<&str>, properties: Option<&DictRef>, ) -> Result<Self, Error>
Initialize Pipewire and create a new ThreadLoopBox
with the given name
and optional properties.
§Safety
TODO
Sourcepub unsafe fn new_cstr(
name: Option<&CStr>,
properties: Option<&DictRef>,
) -> Result<Self, Error>
pub unsafe fn new_cstr( name: Option<&CStr>, properties: Option<&DictRef>, ) -> Result<Self, Error>
Initialize Pipewire and create a new ThreadLoopBox
with the given name
as a C string,
and optional properties.
§Safety
TODO
Sourcepub unsafe fn from_raw(ptr: NonNull<pw_thread_loop>) -> Self
pub unsafe fn from_raw(ptr: NonNull<pw_thread_loop>) -> Self
Create a new thread loop from a raw pw_thread_loop
, taking ownership of it.
§Safety
The provided pointer must point to a valid, well aligned pw_thread_loop
.
The raw loop should not be manually destroyed or moved, as the new ThreadLoopBox
takes ownership of it.
pub fn into_raw(self) -> NonNull<pw_thread_loop>
Methods from Deref<Target = ThreadLoop>§
pub fn as_raw(&self) -> &pw_thread_loop
pub fn as_raw_ptr(&self) -> *mut pw_thread_loop
pub fn loop_(&self) -> &Loop
Sourcepub fn lock(&self) -> ThreadLoopLockGuard<'_>
pub fn lock(&self) -> ThreadLoopLockGuard<'_>
Lock the Loop
This ensures that the loop thread will not access objects associated
with the loop while the lock is held, lock()
can be used multiple times
from the same thread.
The lock needs to be held whenever you call any PipeWire function that uses an object associated with this loop. Make sure to not hold on to the lock more than necessary though, as the threaded loop stops while the lock is held.
Sourcepub fn wait(&self)
pub fn wait(&self)
Release the lock and wait
Release the lock and wait until some thread calls signal()
Sourcepub fn timed_wait(&self, wait_max_sec: Duration)
pub fn timed_wait(&self, wait_max_sec: Duration)
Release the lock and wait a maximum of wait_max_sec
seconds
until some thread calls signal()
or time out
Sourcepub fn get_time(&self, timeout: i64) -> TimeSpec
pub fn get_time(&self, timeout: i64) -> TimeSpec
Get a timespec suitable for timed_wait_full()
Sourcepub fn timed_wait_full(&self, abstime: TimeSpec)
pub fn timed_wait_full(&self, abstime: TimeSpec)
Release the lock and wait up to abs seconds until some
thread calls signal()
. Use get_time()
to get a suitable timespec