Documentation Home >> Headers >> <jss/actor.hpp> Header >> jss::actor >> jss::actor::send member function

The send member function allows you to send a message of any type to an actor.

template<typename Msg>
void send(Msg&& msg);

Effects:

Post a copy of msg on the internal message queue of the actor, constructed with Msg m(std::forward<Msg>(msg)).

Throws:

std::bad_alloc if the memory required to post the message could not be allocated; jss::poisoned_queue if the actor has already completed execution; any exceptions thrown by the copy or move constructor of Msg.

Synchronization:

The completion of the call to send() synchronizes-with a call to receive() that receives the posted message.

Multiple threads may call send() concurrently on the same actor without external synchronization. If a call to send() from one thread happens-before a call to send() from another thread then the message sent by the first thread will be received before the message sent from the second. If two threads call send() and neither call happens-before the other then the order in which those messages will be received is unspecified.

Header

#include <jss/actor.hpp>

See Also