Struct tarantool::fiber::JoinHandle
source · pub struct JoinHandle<'f, T> { /* private fields */ }
Expand description
An owned permission to join a fiber (block on its termination).
NOTE: if JoinHandle
is dropped before JoinHandle::join
is called on it
a panic will happen. Moreover some of the memory needed for passing the
result from the fiber to the caller will be leaked in case the panic is
caught. Note also that panics within tarantool are in general not recoverable.
Implementations§
source§impl<'f, T> JoinHandle<'f, T>
impl<'f, T> JoinHandle<'f, T>
sourcepub fn id(&self) -> FiberId
pub fn id(&self) -> FiberId
Returns the underlying fiber id.
The fiber id can be used for example with wakeup
, cancel
,
exists
, csw_of
, etc.
Panicking
This will panic if the current tarantool executable doesn’t support the
required api (i.e. has_fiber_id
returns false
).
Consider using Self::id_checked
if you want to handle this error.
sourcepub fn id_checked(&self) -> Option<FiberId>
pub fn id_checked(&self) -> Option<FiberId>
Returns the underlying fiber id or None
if the current tarantool
executable doesn’t support the required api
(i.e. has_fiber_id
returns false
).
The fiber id can be used for example with wakeup
, cancel
,
exists
, csw_of
, etc.
sourcepub fn cancel(&self)
pub fn cancel(&self)
Cancel the underlying fiber.
Does NOT yield.
NOTE: tarantool does not guarantee that the cancelled fiber stops executing.
It’s the responsibility of the fiber’s author to check if it was cancelled
by checking is_cancelled
or similar after any yielding calls and
explicitly returning.
Trait Implementations§
source§impl<'f, T> Debug for JoinHandle<'f, T>
impl<'f, T> Debug for JoinHandle<'f, T>
source§impl<'f, T> Drop for JoinHandle<'f, T>
impl<'f, T> Drop for JoinHandle<'f, T>
source§impl<'f, T: Hash> Hash for JoinHandle<'f, T>
impl<'f, T: Hash> Hash for JoinHandle<'f, T>
source§impl<'f, T: PartialEq> PartialEq for JoinHandle<'f, T>
impl<'f, T: PartialEq> PartialEq for JoinHandle<'f, T>
source§fn eq(&self, other: &JoinHandle<'f, T>) -> bool
fn eq(&self, other: &JoinHandle<'f, T>) -> bool
self
and other
values to be equal, and is used
by ==
.