NAME
Win32::Semaphore - Use Win32 semaphore objects from Perl
SYNOPSIS require Win32::Semaphore;
$sem = Win32::Semaphore->new($initial,$maximum,$name);
$sem->wait;
DESCRIPTION
This module allows access to Win32 semaphore objects. The wait method and wait_all & wait_any functions are inherited from the "Win32::IPC" module.
Methods
- $semaphore = Win32::Semaphore->new($initial, $maximum, [$name])
-
Constructor for a new semaphore object.
$initialis the initial count, and$maximumis the maximum count for the semaphore. If$nameis omitted, creates an unnamed semaphore object.If
$namesignifies an existing semaphore object, then$initialand$maximumare ignored and the object is opened. - $semaphore = Win32::Semaphore->open($name)
-
Constructor for opening an existing semaphore object.
- $semaphore->release([$increment, [$previous]])
-
Increment the count of
$semaphoreby$increment(default 1). If$incrementplus the semaphore's current count is more than its maximum count, the count is not changed. Returns true if the increment is successful.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. - $semaphore->wait([$timeout])
-
Wait for
$semaphore's count to be nonzero, then decrement it by 1. See "Win32::IPC".
Deprecated Functions and Methods
Win32::Semaphore still supports the ActiveWare syntax, but its use is deprecated.
- Win32::Semaphore::Create($SemObject,$Initial,$Max,$Name)
-
Use
$SemObject = Win32::Semaphore->new($Initial,$Max,$Name)instead. - Win32::Semaphore::Open($SemObject, $Name)
-
Use
$SemObject = Win32::Semaphore->open($Name)instead. - $SemObj->Release($Count,$LastVal)
-
Use
$SemObj->release($Count,$LastVal)instead.
AUTHOR
Christopher J. Madsen <ac608@yfn.ysu.edu>
Loosely based on the original module by ActiveWare Internet Corp., http://www.ActiveWare.com