A System V semaphore set
Create a new semaphore set if it does not exist yet
The semaphore set will be created with
nsems semaphores and
key. This operation will fail if
exclusive is set
Yes and the semaphore with this
key already exists.
mode is used to define the permissions set on the
semaphore; typical usage will be
Note if you want to open as exclusive, in some yet unknown
circumstances (probably linked to a
ftok hash collision),
Linux claims that the semaphore already exists.
So if you plan on opening an exclusive semaphore, you probably
should do so in a loop that tests different values for the
NonZeroU8 passed to
man 2 semget.
Open a pre-existing semaphore set
The semaphore set opened will be the one with key
Clone a semaphore set
Execute a semaphore set operation
This will take all the operations in
ops, and apply them
atomically on the semaphore set, while making sure no
semaphore value goes under zero.
man 2 semop
Retrieves the current value of the
semth semaphore in the
man 2 semctl option
The semaphore number must be strictly less than the number of semaphores passed in when creating the semaphore
Retrieve a semaphore on which to perform operations
idx is greater than or equal to the number of
semaphores given when creating the semaphore
impl RefUnwindSafe for Semaphore[src]
impl UnwindSafe for Semaphore[src]
type Error = Infallible
The type returned in the event of a conversion error.