5 releases

Uses old Rust 2015

0.1.4 Aug 9, 2015
0.1.3 Aug 6, 2015
0.1.2 Aug 5, 2015
0.1.1 Aug 5, 2015
0.1.0 Aug 5, 2015

#23 in #semaphore

Download history 35/week @ 2024-03-11 15/week @ 2024-03-18 7/week @ 2024-03-25 30/week @ 2024-04-01 22/week @ 2024-04-08 19/week @ 2024-04-15 33/week @ 2024-04-22 15/week @ 2024-04-29 23/week @ 2024-05-06 24/week @ 2024-05-13 49/week @ 2024-05-20 18/week @ 2024-05-27 23/week @ 2024-06-03 32/week @ 2024-06-10 16/week @ 2024-06-17 16/week @ 2024-06-24

87 downloads per month
Used in 3 crates

MIT license

19KB
425 lines

sema

A simple semaphore.

Build Status Crates.io Crates.io

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]

sema = "*"

and this to your crate root:

extern crate sema;

Overview

Sema provides a safe Semaphore implementation.

Implementation

Sema has the same semantics on all supported platforms, however due to platform differences, the implementation differs between them.

Linux

On Linux, Semaphores are implemented with futexes. They are based on the current glibc sem_t implementation and share the same semantics.

OS X

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.

Other Platforms

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.

Dependencies

~1–1.3MB
~20K SLoC