Skip to content

Commit 8b10733

Browse files
committed
rollup merge of rust-lang#21389: retep998/timer
Fixes rust-lang#20943 and adds a test for it r? @alexcrichton
2 parents 9173797 + abccfa4 commit 8b10733

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/libstd/io/timer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ mod test {
227227
use thread::Thread;
228228
use time::Duration;
229229

230+
#[test]
231+
fn test_timer_send() {
232+
let mut timer = Timer::new().unwrap();
233+
Thread::spawn(move || timer.sleep(Duration::milliseconds(1)));
234+
}
235+
230236
#[test]
231237
fn test_io_timer_sleep_simple() {
232238
let mut timer = Timer::new().unwrap();

src/libstd/sys/windows/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ pub enum Req {
4848
RemoveTimer(libc::HANDLE, Sender<()>),
4949
}
5050

51+
unsafe impl Send for Timer {}
5152
unsafe impl Send for Req {}
5253

53-
5454
fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
5555
let mut objs = vec![input];
5656
let mut chans = vec![];

0 commit comments

Comments
 (0)