blob: 5548cadf346b792e70986deb3ebaa6e8e8d454aa (
plain) (
blame)
1
2
3
4
5
6
7
8
|
// error: total: is shared in a hold block; only the functions written inside that block can use it
// shared state reached from an actor's handler without going through its hold block
namespace;
include rt, actor;
typecheck on;
hold { shared let total; fn add(int n) { total = total + n; return total; } }
int work(int n) { total = total + n; return n; }
fn main() { actor.Actor<int,int>* a = rt.new(actor.Actor<int,int>); a.spawn(work); a.send(1); a.close(); return 0; }
|