WaitForMsg

Waits for a message.

Synopsis

int32 WaitForMsg (Item msgPortItem, Item* msgItemPtr, Message** pMsgPtr, void** pMsgDataPtr, Item waitMsgItem)

Description

Waits for and retrieves a message from the specified message port. WaitForMsg() is normally used to wait for reply messages from threads to which a message has already been sent.

PollForMsg() calls WaitPort() to wait for and retrieve the message and then LookupItem() to find the pointer to the message. WaitForMsg() does not return until it receives a message from the specified message port.

Arguments

msgPortItem
Item of the message port from which the message is retrieved.
msgItemPtr
Pointer assigned to the item of the retrieved message. If NULL, no pointer is assigned.
pMsgPtr
Pointer assigned to the retrieved message. If NULL, no pointer is assigned.
pMsgDataPtr
Pointer assigned to data buffer of the retrieved message. If NULL, no pointer is assigned.
waitMsgItem
Item of the specific message to wait for. If zero, WaitForMsg() accepts any message from the specified message port.

Return Value

Value
Error Condition
0
None
-1
LookupItem() failed) for the item of the message port
(Portfolio error code)
WaitPort() failed
See "Error Messages" in the 3DO Portfolio Reference Manual for error messages returned by LookupItem() or WaitPort().

Associated Files

MsgUtils.h

See Also

GetMsg, GetThisMsg, PollForMsg, ReplyMsg ReplySmallMsg