Struct itron_solid_fmp3::semaphore::Semaphore[][src]

pub struct Semaphore(_);
This is supported on crate features unstable and dcre only.
Expand description

An owned semaphore.

Deletes the semaphore automatically when dropped. The destructor will panic if the deletion fails.

Implementations

acre_sem: Create a builder for Semaphore.

Examples
use itron::semaphore::Semaphore;
let binary_semaphore = Semaphore::build()
    .finish()
    .expect("failed to create a semaphore");

binary_semaphore.as_ref().wait()
   .expect("failed to perform a wait operation");
binary_semaphore.as_ref().signal()
   .expect("failed to perform a signal operation");
use itron::{semaphore::Semaphore, wait::QueueOrder};
let counting_semaphore = Semaphore::build()
    .initial_count(4)
    .max_count(8)
    .queue_order(QueueOrder::TaskPriority)
    .finish()
    .expect("failed to create a semaphore");

for _ in 0..4 {
    counting_semaphore.as_ref().poll()
       .expect("failed to perform a polling wait operation");
}
counting_semaphore.as_ref().poll()
   .expect_err("unexpectedly succeeded to perform a polling wait operation");

for _ in 0..8 {
    counting_semaphore.as_ref().signal()
       .expect("failed to perform a signal operation");
}
counting_semaphore.as_ref().signal()
   .expect_err("unexpectedly succeeded to perform a signal operation");

Construct a Semaphore from a raw object ID.

Safety

See Object ID Wrappers.

Consume and “leak” self, returning a reference SemaphoreRef<'a>.

Get the raw object ID.

Get the raw object ID as abi::NonNullID.

Borrow Semaphore as SemaphoreRef.

Use this to perform operations on semaphores because most of the methods are implemented on SemaphoreRef but not Semaphore.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.