Struct std::sync::StaticCondvar
[−]
[src]
pub struct StaticCondvar { // some fields omitted }
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Statically allocated condition variables.
This structure is identical to Condvar
except that it is suitable for use
in static initializers for other structures.
Examples
#![feature(static_condvar)] fn main() { use std::sync::{StaticCondvar, CONDVAR_INIT}; static CVAR: StaticCondvar = CONDVAR_INIT; }#![feature(static_condvar)] use std::sync::{StaticCondvar, CONDVAR_INIT}; static CVAR: StaticCondvar = CONDVAR_INIT;
Methods
impl StaticCondvar
[src]
fn new() -> StaticCondvar
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Creates a new condition variable
fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>) -> LockResult<MutexGuard<'a, T>>
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Blocks the current thread until this condition variable receives a notification.
See Condvar::wait
.
fn wait_timeout<'a, T>(&'static self, guard: MutexGuard<'a, T>, timeout: Duration) -> LockResult<(MutexGuard<'a, T>, WaitTimeoutResult)>
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Waits on this condition variable for a notification, timing out after a specified duration.
See Condvar::wait_timeout
.
fn wait_timeout_with<'a, T, F>(&'static self, guard: MutexGuard<'a, T>, dur: Duration, f: F) -> LockResult<(MutexGuard<'a, T>, WaitTimeoutResult)> where F: FnMut(LockResult<&mut T>) -> bool
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Waits on this condition variable for a notification, timing out after a specified duration.
The implementation will repeatedly wait while the duration has not
passed and the function returns false
.
See Condvar::wait_timeout_with
.
fn notify_one(&'static self)
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Wakes up one blocked thread on this condvar.
See Condvar::notify_one
.
fn notify_all(&'static self)
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Wakes up all blocked threads on this condvar.
See Condvar::notify_all
.
unsafe fn destroy(&'static self)
: the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
static_condvar
#27717): the lazy-static crate suffices for static sync primitives and eventually this type shouldn't be necessary as Condvar::new
in a static should suffice
Deallocates all resources associated with this static condvar.
This method is unsafe to call as there is no guarantee that there are no active users of the condvar, and this also doesn't prevent any future users of the condvar. This method is required to be called to not leak memory on all platforms.