Skip to content

Instantly share code, notes, and snippets.

@74hc595
Created July 19, 2016 22:30
Show Gist options
  • Save 74hc595/73f0c708cfde56d9413ff54faac5c324 to your computer and use it in GitHub Desktop.
Save 74hc595/73f0c708cfde56d9413ff54faac5c324 to your computer and use it in GitHub Desktop.
Blocking actor API seems to not work
#include <caf/all.hpp>
using std::chrono::seconds;
using namespace caf;
void my_blocking_actor_fn(blocking_actor *self)
{
self->receive(
[](int val) -> int { return val*2; } /* never called */
);
}
void caf_main(actor_system &system)
{
auto actor1 = system.spawn(my_blocking_actor_fn);
scoped_actor self{system};
/* always times out */
self->request(actor1, seconds(1), 99).receive(
[&](int val) { aout(self) << "return value was " << val << std::endl; },
[&](error &err) { aout(self) << err << std::endl; }
);
}
CAF_MAIN()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment