Hello,

I try to capture a closure in a task and I have the error:
error: cannot capture variable of type `|u64, T|`, which does not fulfill `Send`, in a bounded closure

Any hint to make the closure 'send-able'?

The code I use :

pub fn Pt_start<T:Send> (resolution : u64, userData : T , callback: |u64 , T|) {
        let mut task = task::task();
        task.sched_mode(task::SingleThreaded);
        do task.spawn || {
            let mut timer = timer::Timer::new().unwrap();
            let periodic = timer.periodic(resolution);
            loop {
                periodic.recv();
                callback(10, userData);
            }

        }

    }

thank for your help.

Philippe Delrieu

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to