#[repr(C)]pub struct Thread {
pub ptr: Box<Arc<Mutex<ThreadInner>>>,
pub run_destructor: bool,
}Expand description
Wrapper around Thread because Thread needs to be clone-able
Fields§
§ptr: Box<Arc<Mutex<ThreadInner>>>§run_destructor: boolImplementations§
Source§impl Thread
impl Thread
pub fn new(ti: ThreadInner) -> Self
Sourcepub fn create<C: Into<ThreadCallback>>(
thread_initialize_data: RefAny,
writeback_data: RefAny,
callback: C,
) -> Self
pub fn create<C: Into<ThreadCallback>>( thread_initialize_data: RefAny, writeback_data: RefAny, callback: C, ) -> Self
Creates a new thread that will execute the given callback function.
§Arguments
thread_initialize_data- Data passed to the callback when the thread startswriteback_data- Data that will be passed back when writeback messages are receivedcallback- The callback to execute in the background thread
§Returns
A new Thread handle that can be added to the event loop with CallbackInfo::add_thread
Sourcepub fn send_message(&self, msg: ThreadSendMsg) -> bool
pub fn send_message(&self, msg: ThreadSendMsg) -> bool
Send a control message to the running worker. Interior-mutable (the worker
state is behind a Mutex), so this takes &self and is callable from a
callback that only holds &Thread via CallbackInfo::get_thread. Used to push
resize / seek / source-change messages to a persistent worker. Returns false
if the channel is closed (or always, on no_std).
Sourcepub fn clone_sender(&self) -> Option<Sender<ThreadSendMsg>>
pub fn clone_sender(&self) -> Option<Sender<ThreadSendMsg>>
Clone the main→worker Sender so a holder without a CallbackInfo (e.g. a
dataset-merge callback) can message the running worker later — used for the
scrub/seek path, where the merge callback compares the old/new VideoConfig
and pushes a seek to the worker. None on no_std.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Thread
impl RefUnwindSafe for Thread
impl Send for Thread
impl Sync for Thread
impl Unpin for Thread
impl UnsafeUnpin for Thread
impl UnwindSafe for Thread
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more