A trivial example program.
#include <string>
#include <iostream>
#include "caf/all.hpp"
using std::endl;
using std::string;
return {
[=](const string& what) -> string {
aout(
self) << what << endl;
return string(what.rbegin(), what.rend());
}
};
}
self->request(buddy, std::chrono::seconds(10), "Hello World!").then(
[=](const string& what) {
aout(
self) << what << endl;
}
);
}
auto mirror_actor = system.
spawn(mirror);
system.
spawn(hello_world, mirror_actor);
}
CAF_MAIN()
Describes the behavior of an actor, i.e., provides a message handler and an optional timeout.
Definition: behavior.hpp:39
Actor environment including scheduler, registry, and optional components such as a middleman.
Definition: actor_system.hpp:117
infer_handle_from_class_t< C > spawn(Ts &&... xs)
Returns a new actor of type C using xs... as constructor arguments.
Definition: actor_system.hpp:321