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
- Host: GitHub
- URL: https://github.com/protolambda/ctxlock
- Owner: protolambda
- License: mit
- Created: 2024-06-25T06:40:08.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-25T06:42:18.000Z (11 months ago)
- Last Synced: 2025-02-28T04:58:34.183Z (3 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.