vuoi
o PayPal
tutte le volte che vuoi
semop - semaphore operations
The semop()
function is used to perform atomically a user-defined array of semaphore operations on the set of semaphores associated with the semaphore identifier specified by the argument semid
.
The argument sops
is a pointer to a user-defined array of semaphore operation structures. The implementation will not modify elements of this array unless the application uses implementation-dependent extensions.
The argument nsops
is the number of such structures in the array.
Each structure includes the following members:
sem_num
: semaphore numbersem_op
: semaphore operationsem_flg
: operation flags
Each semaphore operation specified by sem_op
is performed on the semaphores.
The corresponding semaphore specified by semid and sem_num. The variable sem_op specifies one of three semaphore operations:
- If sem_op is a negative integer and the calling process has alter permission, one of the following will occur: <sys/sem.h>, is greater than or equal to the absolute value of If semval, seesem_op, the absolute value of sem_op is subtracted from semval. Also, if(sem_flg&SEM_UNDO) is non-zero, the absolute value of sem_op is added to the calling process' semadj value for the specified semaphore.
- If semval is less than the absolute value of sem_op and(sem_flg&IPC_NOWAIT) is non-zero, semop() will return immediately.
- If semval is less than the absolute value of sem_op and(sem_flg&IPC_NOWAIT) is 0, semop() will increment the semncnt associated with the specified semaphore and suspend execution of the calling thread until one of the following conditions occurs: