[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'ipc' (#rtl)

semop

Perform semaphore operation.

Declaration

Source position: ipc.pp line 873

function semop(

  semid: cint;

  sops: PSEMbuf;

  nsops: cuint

):cint;

Description

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, unless IPC_NOWAIT is specified in the sem_flg.
sem_flg
Optional flags: if IPC_NOWAIT is 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

semget

  

Return the ID of a semaphore set, possibly creating the set

semctl

  

Perform various control operations on a semaphore set


Documentation generated on: Jun 22 2020