Skip to content

Commit 1d60cb7

Browse files
committed
Stabilize some Duration consuming methods
These methods are simply the Duration consuming variants of existing stable methods that take a u32 of milliseconds.
1 parent 5aca49c commit 1d60cb7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/compiletest/runtest.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use std::io::prelude::*;
2727
use std::net::TcpStream;
2828
use std::path::{Path, PathBuf};
2929
use std::process::{Command, Output, ExitStatus};
30+
use std::time::Duration;
3031

3132
pub fn run(config: Config, testfile: &Path) {
3233
match &*config.target {
@@ -431,7 +432,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
431432
.expect(&format!("failed to exec `{:?}`", config.adb_path));
432433
loop {
433434
//waiting 1 second for gdbserver start
434-
::std::thread::sleep_ms(1000);
435+
::std::thread::sleep(Duration::new(1, 0));
435436
if TcpStream::connect("127.0.0.1:5039").is_ok() {
436437
break
437438
}

src/libstd/thread/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ pub fn catch_panic<F, R>(f: F) -> Result<R>
467467
/// specifics or platform-dependent functionality. Note that on unix platforms
468468
/// this function will not return early due to a signal being received or a
469469
/// spurious wakeup.
470+
#[deprecated(since = "1.4.0", reason = "use `thread::sleep` instead")]
470471
#[stable(feature = "rust1", since = "1.0.0")]
471472
pub fn sleep_ms(ms: u32) {
472473
sleep(Duration::from_millis(ms as u64))
@@ -483,7 +484,7 @@ pub fn sleep_ms(ms: u32) {
483484
/// signal being received or a spurious wakeup. Platforms which do not support
484485
/// nanosecond precision for sleeping will have `dur` rounded up to the nearest
485486
/// granularity of time they can sleep for.
486-
#[unstable(feature = "thread_sleep", reason = "waiting on Duration")]
487+
#[stable(feature = "thread_sleep", since = "1.4.0")]
487488
pub fn sleep(dur: Duration) {
488489
imp::Thread::sleep(dur)
489490
}
@@ -533,6 +534,7 @@ pub fn park() {
533534
/// amount of time waited to be precisely *ms* long.
534535
///
535536
/// See the module doc for more detail.
537+
#[deprecated(since = "1.4.0", reason = "use `thread::park_timeout` instead")]
536538
#[stable(feature = "rust1", since = "1.0.0")]
537539
pub fn park_timeout_ms(ms: u32) {
538540
park_timeout(Duration::from_millis(ms as u64))
@@ -553,7 +555,7 @@ pub fn park_timeout_ms(ms: u32) {
553555
///
554556
/// Platforms which do not support nanosecond precision for sleeping will have
555557
/// `dur` rounded up to the nearest granularity of time they can sleep for.
556-
#[unstable(feature = "park_timeout", reason = "waiting on Duration")]
558+
#[stable(feature = "park_timeout", since = "1.4.0")]
557559
pub fn park_timeout(dur: Duration) {
558560
let thread = current();
559561
let mut guard = thread.inner.lock.lock().unwrap();

0 commit comments

Comments
 (0)