Closed
Description
This code:
use std::io::timer::Timer;
use std::thread::Thread;
use std::time::duration::Duration;
fn main() {
let mut timer = Timer::new().unwrap();
Thread::spawn(move || {
timer.sleep(Duration::seconds(1));
});
}
compiles on Linux. On windows it fails to compile with:
$ rustc wintimer.rs
wintimer.rs:7:5: 7:18 error: the trait `core::marker::Send` is not implemented for the type `*mut libc::types::common::c95::c_void`
wintimer.rs:7 Thread::spawn(move || {
^~~~~~~~~~~~~
I'm not sure if different behavior of timer on different OSs is an issue or somewhat "by design". For me the real issue was the unhelpful error message, that exposes an implementation detail but does not point to the part of the code that is actually wrong (where is c_void in my code? It's deep in the gut of the windows implementation for timer).
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-pc-windows-gnu
release: 1.0.0-nightly