-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
z_sleep_*
result type to z_result_t (#701)
- Loading branch information
Showing
2 changed files
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
use std::{thread, time}; | ||
|
||
use crate::result; | ||
|
||
/// Puts current thread to sleep for specified amount of seconds. | ||
#[no_mangle] | ||
pub extern "C" fn z_sleep_s(time: usize) -> i8 { | ||
pub extern "C" fn z_sleep_s(time: usize) -> result::z_result_t { | ||
thread::sleep(time::Duration::from_secs(time as u64)); | ||
0 | ||
result::Z_OK | ||
} | ||
|
||
/// Puts current thread to sleep for specified amount of milliseconds. | ||
#[no_mangle] | ||
pub extern "C" fn z_sleep_ms(time: usize) -> i8 { | ||
pub extern "C" fn z_sleep_ms(time: usize) -> result::z_result_t { | ||
thread::sleep(time::Duration::from_millis(time as u64)); | ||
0 | ||
result::Z_OK | ||
} | ||
|
||
/// Puts current thread to sleep for specified amount of microseconds. | ||
#[no_mangle] | ||
pub extern "C" fn z_sleep_us(time: usize) -> i8 { | ||
pub extern "C" fn z_sleep_us(time: usize) -> result::z_result_t { | ||
thread::sleep(time::Duration::from_micros(time as u64)); | ||
0 | ||
result::Z_OK | ||
} |