3 error::{fail, fail_aborting, ItronError},
6 use crate::mem::MaybeUninit;
8 /// Get the ID of the task in Running state. Panics on failure.
10 pub fn current_task_id() -> abi::ID {
11 try_current_task_id().unwrap_or_else(|e| fail(e, &"get_tid"))
14 /// Get the ID of the task in Running state. Aborts on failure.
16 pub fn current_task_id_aborting() -> abi::ID {
17 try_current_task_id().unwrap_or_else(|e| fail_aborting(e, &"get_tid"))
20 /// Get the ID of the task in Running state.
22 pub fn try_current_task_id() -> Result<abi::ID, ItronError> {
24 let mut out = MaybeUninit::uninit();
25 ItronError::err_if_negative(abi::get_tid(out.as_mut_ptr()))?;
30 /// Get the specified task's priority. Panics on failure.
32 pub fn task_priority(task: abi::ID) -> abi::PRI {
33 try_task_priority(task).unwrap_or_else(|e| fail(e, &"get_pri"))
36 /// Get the specified task's priority.
38 pub fn try_task_priority(task: abi::ID) -> Result<abi::PRI, ItronError> {
40 let mut out = MaybeUninit::uninit();
41 ItronError::err_if_negative(abi::get_pri(task, out.as_mut_ptr()))?;