Rand Stats

Semaphore::ReadersWriters

cpan:MARTIMM

Semaphore Readers Writers Pattern or Light switch

Build Status License

Synopsis

use Semaphore::ReadersWriters;

my Semaphore::ReadersWriters $rw .= new;
$rw.add-mutex-names('shv');
my $shared-var = 10;

# After creating threads ...
# Some writer thread
$rw.writer( 'shv', {$shared-var += 2});

# Some reader thread
say 'Shared var is ', $rw.reader( 'shv', {$shared-var;});

Documentation

The Markdown files in this package uses the atom plugin Markdown Preview Enhanced. E.g. the synopsis can be run by placing the cursor in the code and type `shift-enter' or, if not possible, look for the readme pdf in doc)

TODO

CHANGELOG

See semantic versioning. Please note point 4. on that page: Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

Other info

Perl6 version

Tested on the latest version of perl6 on moarvm

Install

Install package using zef

zef install Semaphore::ReadersWriters

Author

Marcel Timmerman

Contact

MARTIMM on github