Unit 'exec' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#os4units]

WaitPort

Wait for a given port to be non-empty

Declaration

Source position: exec.pas line 1812

function WaitPort(

  Port: PMsgPort

):PMessage;

Arguments

Port

  

A pointer to the message port

Function result

A pointer to the first available message

Description

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

GetMsg

  

Get next message from message port


Documentation generated on: 2021-07-30