Thread::Semaphore

Thread-safe semaphores
Download

Thread::Semaphore Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jerry D. Hedden
  • Publisher web site:
  • http://search.cpan.org/~jdhedden/

Thread::Semaphore Tags


Thread::Semaphore Description

Thread-safe semaphores Semaphores provide a mechanism to regulate access to resources. Unlike locks, semaphores aren't tied to particular scalars, and so may be used to control access to anything you care to use them for.Semaphores don't limit their values to zero and one, so they can be used to control access to some resource that there may be more than one of (e.g., filehandles). Increment and decrement amounts aren't fixed at one either, so threads can reserve or return multiple resources at once.SYNOPSIS use Thread::Semaphore; my $s = Thread::Semaphore->new(); $s->down(); # Also known as the semaphore P operation. # The guarded section is here $s->up(); # Also known as the semaphore V operation. # The default semaphore value is 1 my $s = Thread::Semaphore-new($initial_value); $s->down($down_value); $s->up($up_value); Requirements: · Perl


Thread::Semaphore Related Software