[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

When you attempt to obtain a semaphore with ObtainSemaphore(), your task
will be put to sleep if the semaphore is not currently available. If you
do not want to wait, you can call AttemptSemaphore() instead. If the
semaphore is available for exclusive locking, AttemptSemaphore() obtains
it for you and returns TRUE.  If it is not available, the function returns
FALSE immediately instead of waiting for the semaphore to be released.

To attempt to obtain a semaphore, use the following:

    struct SignalSemaphore *semaphore;
    AttemptSemaphore(semaphore);

To make an attempt to obtain a public semaphore, the following code should
be used:

    UBYTE *name;
    struct SignalSemaphore *semaphore;

    Forbid();
    if (semaphore = FindSemaphore(name)) AttemptSemaphore(semaphore);
    Permit();