Site Tools


documentation:development:opera:pf25:ppgfldr:pgsfldr:spg:07spg003

Locking a Semaphore


To lock a semaphore, thereby preventing other tasks from accessing the associated resource until your task is finished with it, call the LockSemaphore() function:

int32 LockSemaphore( Item s, uint32 flags )

The s argument is the item number of the semaphore for the resource you want to lock. Use the flags argument to specify what to do if the resource is already locked: if you include the SEM_WAIT flag, your task is put into wait state until the resource is available.

LockSemaphore() returns 1 if the resource was locked successfully. If the resource is already locked and you did not include the SEM_WAIT flag in the flags argument, the function returns 0. If an error occurs, the function returns a negative error code.

documentation/development/opera/pf25/ppgfldr/pgsfldr/spg/07spg003.txt · Last modified: 2022/10/10 16:54 by 127.0.0.1