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