pub struct ThreadHandle {
pub id: ThreadId,
pub process_id: ProcessId,
pub state: RwLock<ThreadState>,
pub attributes: ThreadAttributes,
pub exit_value: Mutex<Option<*mut u8>>,
pub joinable: AtomicBool,
pub cpu_time: AtomicU64,
pub context_switches: AtomicU64,
pub cancel_requested: AtomicBool,
}Expand description
Thread handle for management
Fields§
§id: ThreadId§process_id: ProcessId§state: RwLock<ThreadState>§attributes: ThreadAttributes§exit_value: Mutex<Option<*mut u8>>§joinable: AtomicBool§cpu_time: AtomicU64§context_switches: AtomicU64§cancel_requested: AtomicBoolCancellation requested flag
Implementations§
Source§impl ThreadHandle
impl ThreadHandle
Sourcepub fn new(
id: ThreadId,
process_id: ProcessId,
attributes: ThreadAttributes,
) -> Self
pub fn new( id: ThreadId, process_id: ProcessId, attributes: ThreadAttributes, ) -> Self
Create a new thread handle
Sourcepub fn get_state(&self) -> ThreadState
pub fn get_state(&self) -> ThreadState
Get thread state
Sourcepub fn set_state(&self, state: ThreadState)
pub fn set_state(&self, state: ThreadState)
Set thread state
Sourcepub fn is_joinable(&self) -> bool
pub fn is_joinable(&self) -> bool
Check if thread is joinable
Sourcepub fn get_cpu_time(&self) -> u64
pub fn get_cpu_time(&self) -> u64
Get CPU time used by thread
Sourcepub fn get_context_switches(&self) -> u64
pub fn get_context_switches(&self) -> u64
Get number of context switches
Sourcepub fn is_cancel_requested(&self) -> bool
pub fn is_cancel_requested(&self) -> bool
Check if cancellation was requested
Sourcepub fn request_cancel(&self)
pub fn request_cancel(&self)
Request cancellation