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

https://github.com/protolambda/ctxlock

Go Read-Write lock with context cancellation support
https://github.com/protolambda/ctxlock

Last synced: 2 months ago
JSON representation

Go Read-Write lock with context cancellation support

Awesome Lists containing this project

README

        

# ctxlock

Minimal Go read-write-lock with context-cancellation support.

Usage is like `symc.RWMutex`:
- the `Lock` must not be copied
- `Lock()`/`Unlock()` for write locking
- `RLock()`/`RUnlock()` for read locking
- `LockCtx(ctx) error` for write locking with cancellation
- `RLockCtx(ctx) error` for read locking with cancellation
- panics on invalid usage (unlocks when not locked, or unlock type not matching lock type)

## License

MIT, see [`LICENSE`](./LICENSE) file.