/src/test/run-pass/acyclic-unwind.rs

http://github.com/jruderman/rust · Rust · 39 lines · 19 code · 10 blank · 10 comment · 0 complexity · 93ffc1e3ddb6867014ce918c842c4ddc MD5 · raw file

  1. // xfail-test
  2. // -*- rust -*-
  3. use std;
  4. import comm;
  5. import task;
  6. fn f(c: comm::_chan<int>) {
  7. type t = {_0: int, _1: int, _2: int};
  8. // Allocate a box.
  9. let x: @t = @{_0: 1, _1: 2, _2: 3};
  10. // Signal parent that we've allocated a box.
  11. comm::send(c, 1);
  12. loop {
  13. // spin waiting for the parent to kill us.
  14. debug!{"child waiting to die..."};
  15. // while waiting to die, the messages we are
  16. // sending to the channel are never received
  17. // by the parent, therefore this test cases drops
  18. // messages on the floor
  19. comm::send(c, 1);
  20. }
  21. }
  22. fn main() {
  23. let p = comm::mk_port();
  24. task::_spawn(bind f(p.mk_chan()));
  25. let i: int;
  26. // synchronize on event from child.
  27. i = p.recv();
  28. debug!{"parent exiting, killing child"};
  29. }