[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'Exec' (#aros)


Wait for a given port to be non-empty


Source position: exec.pas line 1272

function WaitPort(

  Port: PMsgPort





A pointer to the message port

Function result

A pointer to the first available message


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).

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.

See also



Get next message from message port

Documentation generated on: 2017-01-10