Visual Studio 2010 - Visual C++
Message Passing Functions

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The Asynchronous Agents Library provides several functions that let you pass messages among components.

These message-passing functions are used with the various message-block types. For more information about the message-block types that are defined by the Concurrency Runtime, see Asynchronous Message Blocks.

Sections

This topic describes the following message-passing functions:

send and asend

The send function sends a message to the specified target synchronously and the asend function sends a message to the specified target asynchronously. Both the send and asend functions wait until the target indicates that it accepts or declines the message.

The send function waits until the target accepts or declines the message before it returns. The send function returns true if the message was delivered and false otherwise. Because the send function works synchronously, the send function waits for the target to receive the message before it returns.

The asend function does not wait for the target to accept or decline the message before it returns. The asend function returns true if the target accepts the message and will eventually take it. Otherwise, asend returns false to indicate that the target either declined the message or postponed the decision about whether to take the message.

Example

For examples that use the send and asend functions, see Asynchronous Agents How-to and Walkthrough Topics.

[go to top]

receive and try_receive

The receive and try_receive functions read data from a given source. The receive function waits for data to become available, whereas the try_receive function returns immediately.

Use the receive function when you must have the data to continue. Use the try_receive function if you must not block the current context or you do not have to have the data to continue.

Example

For examples that use the receive function, see Asynchronous Agents How-to and Walkthrough Topics.

[go to top]

See Also

Reference

Concepts

Page view tracker