Thread::Synchronized - synchronize subroutine calls between threads


Thread-Synchronized documentation  | view source Contained in the Thread-Synchronized distribution.

Index


NAME

Top

Thread::Synchronized - synchronize subroutine calls between threads

SYNOPSIS

Top

    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

DESCRIPTION

Top

                  *** 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).

REQUIRED MODULES

Top

 (none)

CAVEATS

Top

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.

AUTHOR

Top

Elizabeth Mattijsen, <liz@dijkmat.nl>.

Please report bugs to <perlbugs@dijkmat.nl>.

COPYRIGHT

Top

SEE ALSO

Top

threads.


Thread-Synchronized documentation  | view source Contained in the Thread-Synchronized distribution.