semop function
Perform semaphore operation.
Declaration
function semop(semid: cint; sops: PSEMbuf; nsops: cuint): cintDescription
semop performs a set of operations on a message queue.
sops points to an array of type
TSEMbuf. The array should
contain
nsops elements.
The fields of the TSEMbuf structure
TSEMbuf = record
sem_num : word;
sem_op : integer;
sem_flg : integer;
should be filled as follows:
- sem_num
- The number of the semaphore in the set on which the operation must be performed.
- sem_op
- The operation to be performed. The operation depends on the
sign of
sem_op: A positive number is simply added to the current value of the semaphore. If 0 (zero) is specified, then the process is suspended until the specified semaphore reaches zero. If a negative number is specified, it is subtracted from the current value of the semaphore. If the value would become negative then the process is suspended until the value becomes big enough, unlessIPC_NOWAITis specified in thesem_flg. - sem_flg
- Optional flags: if
IPC_NOWAITis specified, then the calling process will never be suspended.
The function returns True if the operations were successful,
False otherwise.
Errors
In case of error,
False is returned, and
IPCerror is set.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
