aboutsummaryrefslogtreecommitdiff
path: root/tests/actor/reject/drop_message.zc
blob: fb37d5f864d2f6869e04f7fb82d2f7093fa31aad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// destructors 7: copying a value with a drop into an actor message is an error; two processes would drop it twice
namespace;
include rt, actor;
struct res { int fd; void drop() { rt.put_s("closed"); } }
actor Keeper { int total; int handle(res* r) { return r.fd; } }
fn main() {
	Keeper* k = rt.new(Keeper);
	res* r = rt.new(res); r.fd = 3;
	k.spawn();
	k.send(r);
	k.close();
	return 0;
}