Crates.io | sema |
lib.rs | sema |
version | 0.1.4 |
source | src |
created_at | 2015-08-05 19:50:42.813482 |
updated_at | 2015-12-11 23:55:55.315022 |
description | Rust semaphore library |
homepage | https://github.com/cpjreynolds/sema |
repository | https://github.com/cpjreynolds/sema |
max_upload_size | |
id | 2763 |
size | 19,701 |
A simple semaphore.
Add this to your Cargo.toml
:
[dependencies]
sema = "*"
and this to your crate root:
extern crate sema;
Sema provides a safe Semaphore
implementation.
Sema has the same semantics on all supported platforms, however due to platform differences, the implementation differs between them.
On Linux, Semaphore
s are implemented with futexes. They are based on the
current glibc sem_t
implementation and share the same semantics.
OS X does not implement unnamed semaphores, however it does implement named semaphores, which share the same semantics as their unnamed counterparts but may be shared between processes.
Sema implements pseudo-unnamed semaphores with randomly named semaphores. Since the semantics of their operations remain the same, the only difference is their construction and destruction, however this is transparent to a consumer of this library.
Sema should, in theory, work on any platform that supports POSIX semaphores (or futexes, in the case of Linux). That being said, it would be wise to consult your platform's semaphore manpages just in case.