Skip to content

Mutual Exclusion access to a shared resource between a single writer and multiple concurrent readers.

License

Notifications You must be signed in to change notification settings

grype/Pharo-RWMutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pharo-RWMutex

Mutual Exclusion access to a shared resource between a single writer and multiple concurrent readers.

I am like Mutex that protects write access to a shared resource while granting read access to multiple requestors. Read and write access is mutually exclusive. That is, a write request will block new read requests and wait on existing read-critical processes to finish. Concurrent read requests will be granted until write access is requested.

Example:

mutex := RWMutex new.
[ mutex readCritical: [ ... ] ] fork.
[ mutex readCritical: [ ... ] ] fork.
[ mutex writeCritical: [ ... ] ] fork.
[ mutex writeCritical: [ ... ] ] fork.
[ mutex readCritical: [ ... ] ] fork.

The first forked process will lock write access. The second forked process will take place concurrently with the first. The third forked process will wait for the first two to complete before entering a critical write section, where subsequent write requests, such as the fourth forked process, will wait on it. The final forked process will take place after all of the other process had concluded.

Installation

Metacello new
  repository: 'github://grype/Pharo-RWMutex';
  baseline: 'RWMutex';
  load.

About

Mutual Exclusion access to a shared resource between a single writer and multiple concurrent readers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published