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


   NAME
        Procure -- bid for a semaphore                                   (V39)

   SYNOPSIS
        Procure(semaphore, bidMessage)
                A0          A1

        VOID Procure(struct signalsemaphore *, struct semaphoremessage *);

   FUNCTION
        This function is used to obtain a semaphore in an async manner.
        Like obtainsemaphore(), it will obtain a signalsemaphore for you
        but unlike obtainsemaphore(), you will not block until you get
        the semaphore.  Procure() will just post a request for the semaphore
        and will return.  When the semaphore is available (which could
        be at any time) the bidMessage will replymsg() and you will own
        the semaphore.  This lets you wait on multiple semaphores at once
        and to continue processing while waiting for the semaphore.

        NOTE:  Pre-V39, Procure() and vacate() did not work correctly.
        They also did not operate on signalsemaphore semaphores.
        Old (and broken) MessageSemaphore use as of V39 will no longer work.

   INPUT
        semaphore - The signalsemaphore that you wish to procure()
        bidMessage- The semaphoremessage that you wish replied when
                you obtain access to the semaphore.  The message's
                ssm_Semaphore field will point at the semaphore that
                was obtained.  If the ssm_Semaphore field is NULL,
                the Procure() was aborted via vacate().
                The mn_ReplyPort field of the message must point to
                a valid message port.
                To obtain a shared semaphore, the ln_Name field
                must be set to 1.  For an exclusive lock, the ln_Name
                field must be 0.  No other values are valid.

   BUGS
        Before V39, Procure() and vacate() used a different semaphore
        system that was very broken.  This new system is only available
        as of V39 even though the LVOs are the same.

   SEE ALSO
        obtainsemaphoreshared(), initsemaphore(), releasesemaphore(),
        attemptsemaphore(), obtainsemaphorelist(), vacate(), obtainsemaphore()