For Windows: Not Supported
The %semctl() function performs semaphore control operations.
Syntax
code = %semctl(sem-ID, semnum, cmd, arg) |
Parameter(s)
sem-ID |
Semaphore ID returned by a call to %semget(). |
|
semnum |
Semaphore number in the set, when applicable (depending on cmd). |
|
cmd |
Valid values for cmd are defined in sem.h and ipc.h. The commands below are executed with respect to the semaphore specified by sem-ID and semnum: |
|
getval |
Returns the value of semval. |
|
setval |
Sets semval to the value of arg. |
|
getpid |
Returns the value of sempid. |
|
getncnt |
Returns the value of semncnt. |
|
getzcnt |
Returns the value of semzcnt. |
|
The commands below apply to all semaphores in the set: |
||
getall |
Place all the semaphore values in the arg dimensioned array. |
|
setall |
Set all the semaphores to the values contained in the dimensioned array arg. |
|
These commands are also available: |
||
ipc$stat |
Return a dimensioned array that contains the various fields of the UNIX semaphore structures. The elements are (see the UNIX system documentation): |
|
1 sem_perm.uid |
||
2 sem_perm.cid |
||
3 sem_perm.guid |
||
4 sem_perm.gcid |
||
5 sem_perm.mode |
||
6 sem_perm.seq |
||
7 sem_perm.key |
||
8 sem_nsems |
||
9 sem_otime |
||
10 sem_ctime |
||
ipc$set |
Sets the values of the below members of the data structure associated to sem-ID to the first three elements of the array arg: |
|
1 sem_perm.uid |
||
2 sem_perm.gid |
||
3 sem_perm.mode |
||
ipc$rmid |
Removes the semaphore identifier. |
|
arg |
Dimensioned array that contains the argument. |
Example(s)
include dm,bp,unix.h ipc.h include dm,bp,unix.h sem.h * Set initial semaphore values dim val(3) mat val=0 %semctl(sem-ID, 0, setall, val) |
See Also