Task

Struct Manager_type

Source
pub struct Manager_type(/* private fields */);
Expand description

A manager for tasks.

Implementations§

Source§

impl Manager_type

Source

pub const Root_task_identifier: Task_identifier_type = _

Source

pub unsafe fn Register_task(&self) -> Result_type<()>

Register the current thread as a task.

This function should ONLY be called for testing purposes.

§Safety

This function is unsafe because it can lead to undefined behavior if the current thread is already registered.

Source

pub fn Get_thread_name(&self) -> Option<String>

Source

pub fn Get_task_name( &self, Task_identifier: Task_identifier_type, ) -> Result_type<String>

§Arguments
  • Task_identifier - The identifier of the task.
Source

pub fn New_thread_internal<T, F>( Parent_task_identifier: Task_identifier_type, Name: &str, Stack_size: Option<usize>, Function: F, Main_thread: bool, ) -> Result_type<Join_handle_type<T>>
where T: Send + 'static, F: FnOnce() -> T + Send + 'static,

Source

pub fn New_thread<T, F>( &self, Parent_task_identifier: Task_identifier_type, Name: &str, Stack_size: Option<usize>, Function: F, ) -> Result_type<Join_handle_type<T>>
where T: Send + 'static, F: FnOnce() -> T + Send + 'static,

Create a new thread, returns the identifier of the thread.

This function checks if the parent task exists.

Source

pub fn Sleep(Duration: Duration)

Sleep the current thread for a given duration.

Source

pub fn New_task<T, F>( &self, Parent_task_identifier: Task_identifier_type, Name: &str, Stack_size: Option<usize>, Function: F, ) -> Result_type<(Task_identifier_type, Join_handle_type<T>)>
where T: Send + 'static, F: FnOnce() -> T + Send + 'static,

Create a new child task, returns the identifier of the child task.

§Arguments
  • Parent_task_identifier - The identifier of the parent task, if None, the current task is used.
  • Owner - The identifier of the user that owns the task, if None, the parent task owner is used.
  • Name - The human readable name of the task.
  • Stack_size - The size of the stack of the task.
  • Function - The function that the task will execute.
Source

pub fn Get_child_tasks( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Vec<Task_identifier_type>>

Get the children tasks of a task.

Source

pub fn Get_parent_task( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Task_identifier_type>

Get the parent task of a task.

Source

pub fn Set_user( &self, Task_identifier: Task_identifier_type, User: User_identifier_type, ) -> Result_type<()>

Source

pub fn Set_group( &self, Task_identifier: Task_identifier_type, Group: Group_identifier_type, ) -> Result_type<()>

Source

pub fn Get_children_threads( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Vec<Thread_identifier_type>>

Get the children threads of a task.

Source

pub fn Get_user( &self, Task_identifier: Task_identifier_type, ) -> Result_type<User_identifier_type>

Get user identifier of the owner of a task.

Source

pub fn Get_group( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Group_identifier_type>

Get group identifier of the owner of a task.

Source

pub fn Get_current_thread_identifier(&self) -> Thread_identifier_type

Source

pub fn Get_current_task_identifier(&self) -> Result_type<Task_identifier_type>

Source

pub fn Get_environment_variable( &self, Task_identifier: Task_identifier_type, Name: &str, ) -> Result_type<Environment_variable_type>

Source

pub fn Get_environment_variables( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Vec<Environment_variable_type>>

Source

pub fn Set_environment_variable( &self, Task_identifier: Task_identifier_type, Name: &str, Value: &str, ) -> Result_type<()>

Source

pub fn Remove_environment_variable( &self, Task_identifier: Task_identifier_type, Name: &str, ) -> Result_type<()>

Source

pub fn Pop_signal( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Option<Signal_type>>

Source

pub fn Peek_signal( &self, Task_identifier: Task_identifier_type, ) -> Result_type<Option<Signal_type>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.