Skip to content

uwiger/ordered_mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A gen_server-based lightweight mutex library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages