The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Thread::Barrier - thread execution barrier

SYNOPSIS

use Thread::Barrier;

my $b = new Thread::Barrier;

$b->init($thr_cnt);

$b->wait;

ABSTRACT

Execution barrier for multiple threads.

DESCRIPTION

Thread barriers provide a mechanism for synchronization of multiple threads. All threads issuing a wait on the barrier will block until the count of waiting threads meets some threshold value. This mechanism proves quite useful in situations where processing progresses in stages and completion of the current stage by all threads is the entry criteria for the next stage.

METHODS

new
new COUNT

new creates a new barrier and initializes the threshold count to NUMBER. If NUMBER is not specified, the threshold is set to 0.

init COUNT

init specifies the threshold count for the barrier, must be zero or a positive integer.

wait

wait causes the thread to block until the number of threads blocking on the barrier meets the threshold.

SEE ALSO

perlthrtut.

AUTHOR

Mark Rogaski, <mrogaski@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2002 by Mark Rogaski

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README file distributed with Perl for further details.