#locking #semaphore #operations #sequence #process #async #proc-ctx

procsem

Semaphore used to lock thread/task spanning sequence of operations

1 unstable release

0.1.0 Feb 3, 2023

#25 in #semaphore

0BSD license

8KB
150 lines

procsem

The ProcSem is a semaphore used to lock a sequence of operations that may span multiple threads/tasks.


lib.rs:

A simple process semaphore.

(Note: The word process should be read as a sequence of operations, rather than an operating system process).

The ProcSem is intended to allow mutual exclusion of a chain of operations that may span over several threads/tasks.

This is much like a Mutex, but it differs in that it holds no generic parameter and the ProcCtx (the equivalent of Mutex's MutexGuard) is Send, because it is explicitly meant to be passed around between threads/tasks. It supports blocking, nonblocking and async lock acquisition.

Dependencies

~1.3–6.5MB
~27K SLoC