about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-22 04:21:59 -0700
committerGitHub <noreply@github.com>2016-06-22 04:21:59 -0700
commite41cdabc3e5fff02abfef513d3289370fae358b8 (patch)
tree8c8de5f65c6796c558fd1a8d0f96031bc280499b /src/libstd
parent3ee3267af39aa95fed707c67acb656845eb8f365 (diff)
parentc749a3e4b588ccc46d34e0c7b40a1e9a2f374c5b (diff)
downloadrust-e41cdabc3e5fff02abfef513d3289370fae358b8.tar.gz
rust-e41cdabc3e5fff02abfef513d3289370fae358b8.zip
Auto merge of #34408 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404
- Failed merges:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/macros.rs2
-rw-r--r--src/libstd/sys/unix/thread.rs21
2 files changed, 16 insertions, 7 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index d69789cedaf..26cf8a3199d 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -276,7 +276,7 @@ pub mod builtin {
     /// // fn concat_idents!(new, fun, name) { } // not usable in this way!
     /// # }
     /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
+    #[unstable(feature = "concat_idents", issue = "29599")]
     #[macro_export]
     macro_rules! concat_idents {
         ($($e:ident),*) => ({ /* compiler built-in */ })
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index cb34d1a5fbc..371319a93d2 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -125,16 +125,25 @@ impl Thread {
     }
 
     pub fn sleep(dur: Duration) {
-        let mut ts = libc::timespec {
-            tv_sec: dur.as_secs() as libc::time_t,
-            tv_nsec: dur.subsec_nanos() as libc::c_long,
-        };
+        let mut secs = dur.as_secs();
+        let mut nsecs = dur.subsec_nanos() as libc::c_long;
 
         // If we're awoken with a signal then the return value will be -1 and
         // nanosleep will fill in `ts` with the remaining time.
         unsafe {
-            while libc::nanosleep(&ts, &mut ts) == -1 {
-                assert_eq!(os::errno(), libc::EINTR);
+            while secs > 0 || nsecs > 0 {
+                let mut ts = libc::timespec {
+                    tv_sec: cmp::min(libc::time_t::max_value() as u64, secs) as libc::time_t,
+                    tv_nsec: nsecs,
+                };
+                secs -= ts.tv_sec as u64;
+                if libc::nanosleep(&ts, &mut ts) == -1 {
+                    assert_eq!(os::errno(), libc::EINTR);
+                    secs += ts.tv_sec as u64;
+                    nsecs = ts.tv_nsec;
+                } else {
+                    nsecs = 0;
+                }
             }
         }
     }