[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();