Hi,

I am trying different alternative to kill a task from parent, But I didn't
get any ways to kill a task from its parent.

In the following approach I started worker2 inside worker1 and worker1 from
main. After 1000 miliseconds worker1 dies, but worker2 still continues.

    use std::io::timer::sleep;

    fn worker1(){
        spawn(proc() {
            worker2();
        });
        println!("worker 1");
        sleep(1000);
        fail!("I am done");
    }

    fn worker2(){
        loop{
            println!("worker 2");
        }
    }

    fn main(){
        spawn(proc() {
            worker1();
        });
    }
Any suggestions?

-- 
Regards
Aravinda | ಅರವಿಂದ
http://aravindavk.in
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to