Here is a test case:
use std::rt::thread::Thread;
fn write_loop(rx: Receiver<uint>) {
loop {
match rx.recv_opt() {
Ok(v) => println!("v {}", v),
_ => break
}
}
}
fn main() {
let (tx, rx) = channel();
Thread::start(proc() {
write_loop(rx);
});
tx.send(3u);
}
Output: fatal runtime error: assertion failed: !ptr.is_null()
I guess that's because there is no Task associated with thread and while it is possible to create a task manually - there is no known for me way to put Runtime into it.
Considering there is no direct way to guess what for this thread is created and whether it should use native runtime or not, it is reasonable. But it is still quite unexpected, so I believe there should be either a way to put runtime into it or documentation of Receiver should note that more clearly.
Here is a test case:
Output:
fatal runtime error: assertion failed: !ptr.is_null()I guess that's because there is no
Taskassociated with thread and while it is possible to create a task manually - there is no known for me way to putRuntimeinto it.Considering there is no direct way to guess what for this thread is created and whether it should use native runtime or not, it is reasonable. But it is still quite unexpected, so I believe there should be either a way to put runtime into it or documentation of
Receivershould note that more clearly.