aboutsummaryrefslogtreecommitdiff
path: root/tests/actor/accept/failed_worker.zc
blob: 056a6b6157b5dee6c0d4a6f17b4359b8cbda077f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
namespace;
include rt, actor;
typecheck on;
int fail(int n) { rt.syscall(7, 2, 0, 0); return n; }
int healthy(int n) { return n + 1; }
fn main() {
 actor.Actor<int,int>* a = rt.new(actor.Actor<int,int>); a.spawn(fail); a.recv(fn(int n) { return 0; }); a.send(1);
 rt.put_n(a.await()); rt.put_c(' '); rt.put_n(a.send(2)); rt.put_c(' '); a.close();
 actor.Actor<int,int>* b = rt.new(actor.Actor<int,int>); let result = 0; b.spawn(healthy); b.recv(fn(int n) { result = n; return 0; }); b.send(2); b.await();
 rt.put_n(result); rt.put_c(10); b.close(); return 0;
}