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


Try to obtain a Semaphore without blocking in shared mode


Source position: exec.pas line 1328

function AttemptSemaphoreShared(

  SigSem: PSignalSemaphore





An initialized signal semaphore structure

Function result

True if the semaphore was locked, false if some other task already exclusively locked the semaphore.


A lock on a signal semaphore may either be exclusive, or shared. Exclusive locks are granted by the ObtainSemaphore() and AttemptSemaphore() functions. Shared locks are granted by ObtainSemaphoreShared(). Calls may be nested.

Any number of tasks may simultaneously hold a shared lock on a semaphore. Only one task may hold an exclusive lock. A typical application is a list that is often read, but only occasionally written to.

Any exlusive locker will be held off until all shared lockers release the semaphore. Likewise, if an exlusive lock is held, all potential shared lockers will block until the exclusive lock is released. All shared lockers are restarted at the same time. This call is similar to ObtainSemaphoreShared(), except that it will not block if the semaphore could not be locked.

Documentation generated on: 2017-01-10