Mark Drobnak
2 years ago
4 changed files with 26 additions and 17 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
//! Service API
|
||||
//!
|
||||
//! Not all APIs are wrapped in this module, since a lot are fundamentally unsafe.
|
||||
//! Most APIs should be used directly from `ctru-sys`.
|
||||
|
||||
use crate::error::ResultCode; |
||||
use ctru_sys::Handle; |
||||
use std::time::Duration; |
||||
|
||||
/// Wait for an event to fire. If the timeout is reached, an error is returned. You can use
|
||||
/// [`Error::is_timeout`] to check if the error is due to a timeout.
|
||||
pub fn wait_for_event(event: Handle, timeout: Duration) -> crate::Result<()> { |
||||
unsafe { |
||||
ResultCode(ctru_sys::svcWaitSynchronization( |
||||
event, |
||||
timeout.as_nanos() as i64, |
||||
))?; |
||||
} |
||||
Ok(()) |
||||
} |
Loading…
Reference in new issue