8.136. IPC::SemaphoreSystem V Semaphore IPC object class. Uses constants defined in IPC::SysV.
$sem = new IPC::Semaphore(key, nsems, flags) Creates a new semaphore set associated with key and containing nsems semaphores. Uses flags to set the permissions. Creates the new set if the following are true:
$sem->getall Returns the values of the semaphore set as an array.
$sem->getncnt(sem) Returns the number of processes waiting for the semaphore sem to become greater than its current value.
$sem->getpid(sem) Returns the process ID of the last process that operated on semaphore sem.
$sem->getval(sem) Returns the current value of semaphore sem.
$sem->getzcnt(sem) Returns the number of processes waiting for the semaphore sem to become 0.
$sem->id Returns the system identifier for the semaphore set.
$sem->op(oplist) Passes a list of operations to the semop function. oplist is the list of operations, consisting of a concatenation of smaller lists. Each of the smaller lists has three values: the semaphore number, the operation, and a flag. See the semop function in Chapter 5, "Function Reference" for more information.
$sem->remove Removes and destroys the semaphore set.
Accepts either a stat object as returned by the stat method or a list of name/value pairs and sets the following values of the stat structure associated with the semaphore set: uid gid mode (the permission bits)
$sem->setall(values) Sets the values of all the semaphores in the set to those given by the values list. The number of values on the list must match the number of semaphores in the set.
$sem->setval(n, value) Sets the nth value in the semaphore set to value.
$ds = $sem->stat Returns an object of type IPC::Semaphore::stat (which is a subclass of Class::Struct) that provides the following fields: uid gid cuid cgid mode ctime otime nsems Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|