Thread::Synchronized - synchronize subroutine calls between threads
use Thread::Synchronized; # activate synchronized and method attribute sub foo : synchronized { } # only one subroutine running at a time sub bar : synchronized method { } # only one method per object
*** A note of CAUTION *** This module only functions on Perl versions 5.8.0 and later. And then only when threads are enabled with -Dusethreads. It is of no use with any version of Perl before 5.8.0 or without threads enabled. *************************
This module currently adds one feature to threaded programs: the "synchronized" and "method" subroutine attributes which causes calls to that subroutine to be automatically synchronized between threads (only one thread can execute that subroutine at a time or per object at a time).
(none)
This module is implemented using a source filter. This has the advantage of not needing to incur any runtime overhead. But this of course happens at the expense of a slightly longer compile time.
Elizabeth Mattijsen, <liz@dijkmat.nl>.
Please report bugs to <perlbugs@dijkmat.nl>.
Copyright (c) 2003 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
threads.
To install Thread::Synchronized, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Thread::Synchronized
CPAN shell
perl -MCPAN -e shell install Thread::Synchronized
For more information on module installation, please visit the detailed CPAN module installation guide.