rwlock
Version, currently 1.0.38 versions
github.com/spider-gazelle/readers-writer
A simple readers writer lock for crystal lang
Nothing has been indexed for 1.0.3 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
rwlock:
github: spider-gazelle/readers-writer
version: ~> 1.0.3Then run:
shards installshard.yml
No shard.yml has been indexed for 1.0.3. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Readers Writer Lock
Allows any number of concurrent readers, but only one concurrent writer (And while the "write" lock is taken, no read locks can be obtained either) Access is fair. (read, write, read, write requests will occur in the order they arrived.)
Installation
-
Add the dependency to your
shard.yml:dependencies: rwlock: github: spider-gazelle/readers-writer -
Run
shards install
Usage
require "rwlock"
balance = 10
rwlock = RWLock.new
# Reading the balance
rwlock.read { puts balance.inspect }
# Modifying
rwlock.write { balance += 10 }
rwlock.synchronize { balance += 10 }
# Reentrant
rwlock.read do
rwlock.write { balance = 100 } if balance > 100
end
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.3- Tagged
- May 26, 2021
- Commit
d1b4dd2a4c96- Indexed
- not yet
Dependents
Repository
github.com/spider-gazelle/readers-writer
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 30, 2026
- Synced
- Sep 30, 2026
- Versions
- 8