Win32::Semaphore - Use Win32 semaphore objects from Perl |
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.
$initial
is the initial
count, and $maximum
is the maximum count for the semaphore. If
$name
is omitted, creates an unnamed semaphore object.
If $name
signifies an existing semaphore object, then $initial
and $maximum
are ignored and the object is opened.
open($name)
$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.
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.
wait([$timeout])
$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.
$SemObject = Win32::Semaphore->new($Initial,$Max,$Name)
instead.
$SemObject = Win32::Semaphore->open($Name)
instead.
Release($Count,$LastVal)
$SemObj->release($Count,$LastVal)
instead.
Christopher J. Madsen <chris_madsen@geocities.com>
Loosely based on the original module by ActiveWare Internet Corp., http://www.ActiveWare.com
Win32::Semaphore - Use Win32 semaphore objects from Perl |