Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 818 Bytes

README.md

File metadata and controls

19 lines (13 loc) · 818 Bytes

Build Status

ordered_mutex

A gen_server-based lightweight mutex library

This library implements a very lightweight, order-preserving 'mutex'.

The API is:

ordmutex:do(Resource:: any(), Fun :: function() -> any()

The caller may use any resource key to identify the critical section. As soon as there are no clients in the queue for a resource, that resource is deleted from the state. As such, the server automatically garbage-collects the queue system.

On a reasonably modern workstation, the cost of executing the wrapper is in the neighborhood of 10-20 µs, at least up to 1,000 concurrent callers. See the eunit test for a simple benchmark setup.