Struct semka::Sem [−][src]
pub struct Sem { /* fields omitted */ }
Expand description
POSIX implementation of Semaphore
Implementations
impl Sem
[src]
impl Sem
[src]pub const unsafe fn new_uninit() -> Self
[src]
pub const unsafe fn new_uninit() -> Self
[src]Creates new uninit instance.
It is UB to use it until init
is called.
#[must_use]pub fn init(&self, init: u32) -> bool
[src]
#[must_use]pub fn init(&self, init: u32) -> bool
[src]Initializes semaphore with provided init
as initial value.
Returns true
on success.
Returns false
if semaphore is already initialized or initialization failed.
pub fn wait(&self)
[src]
pub fn wait(&self)
[src]Decrements self, returning immediately if it was signaled.
Otherwise awaits for signal.
pub fn try_wait(&self) -> bool
[src]
pub fn try_wait(&self) -> bool
[src]Attempts to decrement self, returning whether self was signaled or not.
Returns true
if self was signaled.
Returns false
otherwise.
pub fn wait_timeout(&self, duration: Duration) -> bool
[src]
pub fn wait_timeout(&self, duration: Duration) -> bool
[src]Attempts to decrement self within provided time, returning whether self was signaled or not.
Returns true
if self was signaled within specified timeout
Returns false
otherwise