| %SEMGET | Index Level | %SETFLUSH |
| Syntax | code = %SEMOP( semid, sops, nsops ) |
| Category | BASIC |
| Type | C Function |
| Description |
performs an array of semaphore operations on a set of semaphores.
semid Semaphore identifier returned by a call to semget(). sops Array of semaphores operation. "sops" is a "nsops" by 3 two-dimension array. Each row in the array is the equivalent of a "sops" structure, as defined in the Unix Programmer Reference Guide. In other words, sops(i,1) is sem_num, sops(i,2) is sem_op, sops(i,3) is sem_flg. See the Unix documentation for the description of these fields. nsops Number of rows in the "sops" array. |
| Options | |
| See Also | %SEMGET %SEMCTL |
| Example |
include dm,bp,unix.h ipc.h
include dm,bp,unix.h sem.h include dm,bp,unix.h mode.h * Get a set of 4 semaphores semid=semget( key, 4, IPC$CREAT ) if semid<0 then crt "semget error=":system(0) stop end * Wait for: (1st sem >=1) and (2nd sem >=2) dim sops(2,3) * - Set 1st condition sops(1,1)=0 ;* 1st sem sops(1,2)=-1 ;* Wait until can do -1 sops(1,3)=0 ;* No flag * - Set 2nd condition sops(1,1)=1 ;* 2nd sem sops(1,2)=-2 ;* Wait until can do -2 sops(1,3)=0 ;* No flag n=semop( semid, sops, 2) if n<0 then crt "semop error=":system(0) stop end |
| Warnings | Note the elements of the "sops" array are integers, instead of short integers, as the regular libc.a call. |
| Compatibility | D3/Unix AP 6.1 |
| %SEMGET | Index Level | %SETFLUSH |