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

#22 in #semaphore

Download history 6/week @ 2023-12-04 10/week @ 2023-12-11 23/week @ 2023-12-18 5/week @ 2023-12-25 2/week @ 2024-01-01 3/week @ 2024-01-08 5/week @ 2024-01-15 1/week @ 2024-01-22 7/week @ 2024-01-29 24/week @ 2024-02-12 19/week @ 2024-02-19 28/week @ 2024-02-26 30/week @ 2024-03-04 35/week @ 2024-03-11 15/week @ 2024-03-18

111 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