Win32::Semaphore - Use Win32 semaphore objects from Perl
$sem = Win32::Semaphore->new($initial,$maximum,$name); $sem->wait;
This module allows access to Win32 semaphore objects. The wait method and wait_all & wait_any functions are inherited from the "Win32::IPC" module.
wait
wait_all
wait_any
Constructor for a new semaphore object. $initial is the initial count, and $maximum is the maximum count for the semaphore. If $name is omitted, creates an unnamed semaphore object.
$initial
$maximum
$name
If $name signifies an existing semaphore object, then $initial and $maximum are ignored and the object is opened.
Constructor for opening an existing semaphore object.
Increment the count of $semaphore by $increment (default 1). If $increment plus the semaphore's current count is more than its maximum count, the count is not changed. Returns true if the increment is successful.
$semaphore
$increment
The semaphore's count (before incrementing) is stored in the second argument (if any).
It is not necessary to wait on a semaphore before calling release, but you'd better know what you're doing.
release
Wait for $semaphore's count to be nonzero, then decrement it by 1. See "Win32::IPC".
Win32::Semaphore still supports the ActiveWare syntax, but its use is deprecated.
Use $SemObject = Win32::Semaphore->new($Initial,$Max,$Name) instead.
$SemObject = Win32::Semaphore->new($Initial,$Max,$Name)
Use $SemObject = Win32::Semaphore->open($Name) instead.
$SemObject = Win32::Semaphore->open($Name)
Use $SemObj->release($Count,$LastVal) instead.
$SemObj->release($Count,$LastVal)
Christopher J. Madsen <chris_madsen@geocities.com>
Loosely based on the original module by ActiveWare Internet Corp., http://www.ActiveWare.com
To install Win32, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32
CPAN shell
perl -MCPAN -e shell install Win32
For more information on module installation, please visit the detailed CPAN module installation guide.