aboutsummaryrefslogtreecommitdiff
path: root/tests/actor/accept/lifecycle.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/actor/accept/lifecycle.zc')
-rw-r--r--tests/actor/accept/lifecycle.zc10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/actor/accept/lifecycle.zc b/tests/actor/accept/lifecycle.zc
new file mode 100644
index 0000000..0c953e4
--- /dev/null
+++ b/tests/actor/accept/lifecycle.zc
@@ -0,0 +1,10 @@
+namespace;
+include rt, actor;
+typecheck on;
+int handle(int n) { return n; }
+fn main() {
+ let total = 0;
+ { actor.Actor<int,int>* a = rt.new(actor.Actor<int,int>); a.spawn(handle); a.recv(fn(int n) { total += n; return 0; }); a.send(1); a.await(); a.close(); rt.put_n(a.send(3)); rt.put_c(' '); a.close(); }
+ { actor.Actor<int,int>* b = rt.new(actor.Actor<int,int>); b.spawn(handle); b.recv(fn(int n) { total += n; return 0; }); b.send(2); b.await(); b.close(); }
+ rt.put_n(total); rt.put_c(10); return 0;
+}