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


   NAME
        WaitPort -- wait for a given port to be non-empty

   SYNOPSIS
        message = WaitPort(port)
        D0                 A0

        struct message *waitport(struct msgport *);

   FUNCTION
        This function waits for the given port to become non-empty.  If
        necessary, the wait() function will be called to wait for the port
        signal.  If a message is already present at the port, this function
        will return immediately.  The return value is always a pointer to
        the first message queued (but it is not removed from the queue).

   CAUTION
        More than one message may be at the port when this returns.  It is
        proper to call the getmsg() function in a loop until all messages
        have been handled, then wait for more to arrive.

        To wait for more than one port, combine the signal bits from each
        port into one call to the wait() function, then use a getmsg() loop
        to collect any and all messages.  It is possible to get a signal
        for a port WITHOUT a message showing up.  Plan for this.

   INPUT
        port - a pointer to the message port

   RETURN
        message - a pointer to the first available message

   SEE ALSO
        getmsg()