Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/janos/multex

Multiple mutual exclusion lock
https://github.com/janos/multex

go golang lock mutex

Last synced: about 1 month ago
JSON representation

Multiple mutual exclusion lock

Awesome Lists containing this project

README

        

# Multiple mutual exclusion lock

[![GoDoc](https://godoc.org/resenje.org/multex?status.svg)](https://godoc.org/resenje.org/multex)
[![Go](https://github.com/janos/multex/workflows/Go/badge.svg)](https://github.com/janos/multex/actions?query=workflow%3AGo)

Package mutex provides multiple mutual exclusion lock. The name is
constructed by combining a common name for mutual exclusion locks, Mutex, and
word multiple, which is a property of this specific implementation. Multex
locking and unlocking for a single key is a few times slower then locking
with sync.Mutex, but provides the ability to lock the same block of code with
specific keys, allowing concurrent execution of the same code only for
different keys.

Performance comparison of Multex with a single key and sync.Mutex can be done
by running benchmarks in this package.

```
BenchmarkMultex-10 39488458 26.89 ns/op 0 B/op 0 allocs/op
BenchmarkMutex-10 86903780 13.41 ns/op 0 B/op 0 allocs/op
```

## Installation

Run `go get resenje.org/multex` from command line.