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

#28 in #semaphore

Download history 15/week @ 2024-08-26 3/week @ 2024-09-02 10/week @ 2024-09-09 34/week @ 2024-09-23 25/week @ 2024-09-30 11/week @ 2024-10-07 24/week @ 2024-10-14 20/week @ 2024-10-21 8/week @ 2024-10-28 18/week @ 2024-11-04 17/week @ 2024-11-11 35/week @ 2024-11-18 16/week @ 2024-11-25 15/week @ 2024-12-02 30/week @ 2024-12-09

100 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.4MB
~22K SLoC