POSIX::RT::Semaphore

Perl interface to POSIX.1b semaphores
Download

POSIX::RT::Semaphore Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Michael J. Pomraning
  • Publisher web site:
  • http://search.cpan.org/~mjp/

POSIX::RT::Semaphore Tags


POSIX::RT::Semaphore Description

Perl interface to POSIX.1b semaphores POSIX::RT::Semaphore is a Perl module that provides an object-oriented Perl interface to POSIX.1b Realtime semaphores, as supported by your system. A POSIX semaphore (herein: psem) is a high-performance, persistent synchronization device.Unnamed psems are typically used for synchronization between the threads of a single process, or between a set of related processes which have inherited the psem from a common ancestor. Named psems are typically used for interprocess synchronization, but may also serve interthreaded designs.SYNOPSIS use POSIX::RT::Semaphore; use Fcntl; # O_CREAT, O_EXCL for named semaphore creation ## unnamed semaphore, initial value 1 $sem = POSIX::RT::Semaphore->init(0, 1); ## named semaphore, initial value 1 $nsem = POSIX::RT::Semaphore->open("/mysem", O_CREAT, 0660, 1); ## method synopsis $sem->wait; # down (P) operation ... protected section ... $sem->post; # up (V) operation if ($sem->trywait) { # non-blocking wait (trydown) ... protected section ... $sem->post; } $sem->timedwait(time() + 10); # wait up to 10 seconds Requirements: · Perl


POSIX::RT::Semaphore Related Software