Struct ThreadLoopRc

Source
pub struct ThreadLoopRc { /* private fields */ }

Implementations§

Source§

impl ThreadLoopRc

Source

pub unsafe fn new( name: Option<&str>, properties: Option<&DictRef>, ) -> Result<Self, Error>

Initialize Pipewire and create a new ThreadLoopRc with the given name and optional properties.

§Safety

TODO

Source

pub unsafe fn new_cstr( name: Option<&CStr>, properties: Option<&DictRef>, ) -> Result<Self, Error>

Initialize Pipewire and create a new ThreadLoopRc with the given name as C string, and optional properties.

§Safety

TODO

Source

pub unsafe fn from_box(thread_loop: ThreadLoopBox) -> Self

Create a ThreadLoopRc using an existing ThreadLoopBox.

§Safety

TODO

Source

pub unsafe fn from_raw(ptr: NonNull<pw_thread_loop>) -> Self

Create a new main 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 ThreadLoopRc takes ownership of it.

Source

pub fn downgrade(&self) -> ThreadLoopWeak

Methods from Deref<Target = ThreadLoop>§

Source

pub fn as_raw(&self) -> &pw_thread_loop

Source

pub fn as_raw_ptr(&self) -> *mut pw_thread_loop

Source

pub fn loop_(&self) -> &Loop

Source

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.

Source

pub fn start(&self)

Start the ThreadLoop

Source

pub fn stop(&self)

Stop the ThreadLoop

Stopping the ThreadLoop must be called without the lock

Source

pub fn signal(&self, signal: bool)

Signal all threads waiting with wait()

Source

pub fn wait(&self)

Release the lock and wait

Release the lock and wait until some thread calls signal()

Source

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

Source

pub fn get_time(&self, timeout: i64) -> TimeSpec

Get a timespec suitable for timed_wait_full()

Source

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

Source

pub fn accept(&self)

Signal all threads executing signal() with wait_for_accept

Source

pub fn in_thread(&self)

Check if inside the thread

Trait Implementations§

Source§

impl AsRef<Loop> for ThreadLoopRc

Source§

fn as_ref(&self) -> &Loop

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ThreadLoop> for ThreadLoopRc

Source§

fn as_ref(&self) -> &ThreadLoop

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ThreadLoopRc

Source§

fn clone(&self) -> ThreadLoopRc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ThreadLoopRc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for ThreadLoopRc

Source§

type Target = ThreadLoop

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl IsLoopRc for ThreadLoopRc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.