Struct winproc::Thread [−][src]
pub struct Thread { /* fields omitted */ }
A handle to a running thread.
Methods
impl Thread
[src]
impl Thread
pub fn from_id(id: u32) -> WinResult<Thread>
[src]
pub fn from_id(id: u32) -> WinResult<Thread>
Creates a thread handle from a thread ID.
pub fn handle(&self) -> &Handle
[src]
pub fn handle(&self) -> &Handle
pub fn id(&self) -> u32
[src]
pub fn id(&self) -> u32
Return's the thread's ID.
pub fn cycle_time(&self) -> WinResult<u64>
[src]
pub fn cycle_time(&self) -> WinResult<u64>
Returns the thread's cycle time.
pub fn ideal_processor(&self) -> WinResult<u32>
[src]
pub fn ideal_processor(&self) -> WinResult<u32>
Returns the thread's ideal processor.
pub fn set_ideal_processor(&mut self, processor: u32) -> WinResult<u32>
[src]
pub fn set_ideal_processor(&mut self, processor: u32) -> WinResult<u32>
Sets the thread's ideal processor. On success, returns the previous ideal processor.
pub fn affinity_mask(&self) -> WinResult<usize>
[src]
pub fn affinity_mask(&self) -> WinResult<usize>
Returns the thread's current affinity mask.
pub fn set_affinity_mask(&mut self, mask: usize) -> WinResult<usize>
[src]
pub fn set_affinity_mask(&mut self, mask: usize) -> WinResult<usize>
Sets the affinity mask of the thread. On success, returns the previous affinity mask.
A thread affinity mask is a bit vector in which each bit represents a logical processor that a thread is allowed to run on. A thread affinity mask must be a subset of the process affinity mask for the containing process of a thread. A thread can only run on the processors its process can run on. Therefore, the thread affinity mask cannot specify a 1 bit for a processor when the process affinity mask specifies a 0 bit for that processor.
Setting an affinity mask for a process or thread can result in threads receiving less processor time, as the system is restricted from running the threads on certain processors. In most cases, it is better to let the system select an available processor.
If the new thread affinity mask does not specify the processor that is currently running the thread, the thread is rescheduled on one of the allowable processors.
pub fn set_affinity(&mut self, processor: u8) -> WinResult<usize>
[src]
pub fn set_affinity(&mut self, processor: u8) -> WinResult<usize>
Sets the affinity of the thread to the single specified processor.
If the processor index equals or exceeds the width of usize, the mask is not changed. On success, or if unchanged, returns the previous affinity mask.
Trait Implementations
impl Debug for Thread
[src]
impl Debug for Thread
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRawHandle for Thread
[src]
impl AsRawHandle for Thread
fn as_raw_handle(&self) -> HANDLE
[src]
fn as_raw_handle(&self) -> HANDLE
Extracts the raw handle, without taking any ownership.
impl Deref for Thread
[src]
impl Deref for Thread
type Target = HANDLE
The resulting type after dereferencing.
fn deref(&self) -> &HANDLE
[src]
fn deref(&self) -> &HANDLE
Dereferences the value.
impl FromRawHandle for Thread
[src]
impl FromRawHandle for Thread
unsafe fn from_raw_handle(handle: HANDLE) -> Thread
[src]
unsafe fn from_raw_handle(handle: HANDLE) -> Thread
Constructs a new I/O object from the specified raw handle. Read more
impl IntoRawHandle for Thread
[src]
impl IntoRawHandle for Thread
fn into_raw_handle(self) -> HANDLE
[src]
fn into_raw_handle(self) -> HANDLE
Consumes this object, returning the raw underlying handle. Read more