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

GetMsg

Get next message from message port

Declaration

Source position: exec.pas line 1951

function GetMsg(

  port: PMsgPort

):PMessage;

Arguments

port

  

Message port to check for new message

Function result

A pointer to the first message available. If there are no messages, nil is returned.

Description

This function receives a message from a given message port. It provides a fast, non-copying message receiving mechanism. The received message is removed from the message port.

This function will not wait. If a message is not present this function will return nil. If a program must wait for a message, it can Wait() on the signal specified for the port or use the WaitPort() function. There can only be one task waiting for any given port.

Getting a message does not imply to the sender that the message is free to be reused by the sender. When the receiver is finished with the message, it may ReplyMsg() it back to the sender.

Getting a signal does NOT always imply a message is ready. More than one message may arrive per signal, and signals may show up without messages. Typically you must loop to GetMsg() until it returns zero, then Wait() or WaitPort().

See also

PutMsg

  

Put a message to a message port

ReplyMsg

  

Put a message to its reply port

WaitPort

  

Wait for a given port to be non-empty

Wait

  

Wait for one or more signals


Documentation generated on: 2021-07-30