]> git.lizzy.rs Git - rust.git/commitdiff
Impl Send for Timer on Windows
authorPeter Atashian <retep998@gmail.com>
Mon, 19 Jan 2015 10:55:15 +0000 (05:55 -0500)
committerPeter Atashian <retep998@gmail.com>
Mon, 19 Jan 2015 10:55:15 +0000 (05:55 -0500)
Fixes #20943

Signed-off-by: Peter Atashian <retep998@gmail.com>
src/libstd/io/timer.rs
src/libstd/sys/windows/timer.rs

index 844a97dea2d50eacb54817873e8b5c30c373a37f..68ae7d0ff2083d061fca4eec189d2fdb712fa4e5 100644 (file)
@@ -227,6 +227,12 @@ mod test {
     use thread::Thread;
     use time::Duration;
 
+    #[test]
+    fn test_timer_send() {
+        let mut timer = Timer::new().unwrap();
+        Thread::spawn(move || timer.sleep(Duration::milliseconds(1)));
+    }
+
     #[test]
     fn test_io_timer_sleep_simple() {
         let mut timer = Timer::new().unwrap();
index 1ae3979cd9accac8679f91c7c8f02ffc6ebcd080..12b4e56bf5209f64c9f1e1360ba7218fafda830d 100644 (file)
@@ -48,9 +48,9 @@ pub enum Req {
     RemoveTimer(libc::HANDLE, Sender<()>),
 }
 
+unsafe impl Send for Timer {}
 unsafe impl Send for Req {}
 
-
 fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
     let mut objs = vec![input];
     let mut chans = vec![];