fixed rustdoc tests
This commit is contained in:
committed by
Siegfried Kienzle
parent
733068dc8d
commit
76dd61f48b
@@ -18,6 +18,16 @@ fn nanosleep(rqtp: *const libc::timespec, rmtp: *mut libc::timespec) -> libc::c_
|
||||
|
||||
/// Sleeps for the given duration.
|
||||
///
|
||||
/// Examples:
|
||||
///
|
||||
/// ```rust
|
||||
/// extern crate sleep;
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// // sleep 10 ms
|
||||
/// sleep::sleep(Duration::from_millis(10));
|
||||
/// ```
|
||||
///
|
||||
/// Uses `clock_nanosleep` on linux and `nanosleep` on darwin.
|
||||
pub fn sleep(duration: Duration) -> Result<Duration, libc::c_int> {
|
||||
let ts = duration_to_timespec(duration);
|
||||
@@ -57,8 +67,11 @@ fn timespec_to_duration(timespec: libc::timespec) -> Duration {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// extern crate libc;
|
||||
/// extern crate sleep;
|
||||
///
|
||||
/// // set *round-robin* policy (default) and priority 99 (realtime) for own process
|
||||
/// set_scheduler(0, libc::SCHED_RR, 99);
|
||||
/// sleep::set_scheduler(0, libc::SCHED_RR, 99);
|
||||
/// ```
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn set_scheduler(pid: libc::pid_t, policy: libc::c_int, priority: libc::c_int) -> libc::c_int {
|
||||
@@ -71,8 +84,10 @@ pub fn set_scheduler(pid: libc::pid_t, policy: libc::c_int, priority: libc::c_in
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// extern crate sleep;
|
||||
///
|
||||
/// // set *round-robin* policy (default) and priority 99 (realtime)
|
||||
/// set_priority(99);
|
||||
/// sleep::set_priority(99);
|
||||
/// ```
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn set_priority(priority: i32) -> libc::c_int {
|
||||
|
||||
Reference in New Issue
Block a user