Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (46 sloc) 1.179 kb
#include "cppa/config.hpp"
#include <map>
#include <list>
#include <mutex>
#include <iostream>
#include <algorithm>
#include "test.hpp"
#include "cppa/on.hpp"
#include "cppa/self.hpp"
#include "cppa/cppa.hpp"
#include "cppa/actor.hpp"
#include "cppa/group.hpp"
#include "cppa/ref_counted.hpp"
#include "cppa/intrusive_ptr.hpp"
using std::cout;
using std::endl;
using std::string;
using namespace cppa;
int main() {
CPPA_TEST(test__local_group);
auto foo_group = group::get("local", "foo");
actor_ptr master = self;
for (int i = 0; i < 5; ++i) {
// spawn five workers and let them join local/foo
spawn_in_group(foo_group, [master]() {
receive(on<int>() >> [master](int v) {
send(master, v);
});
});
}
send(foo_group, 2);
int result = 0;
do_receive (
on<int>() >> [&](int value) {
CPPA_CHECK(value == 2);
result += value;
},
after(std::chrono::seconds(2)) >> [&]() {
CPPA_CHECK(false);
result = 10;
}
)
.until(gref(result) == 10);
await_all_others_done();
return CPPA_TEST_RESULT;
}
Jump to Line
Something went wrong with that request. Please try again.