Trait thread_priority::windows::ThreadExt

source ·
pub trait ThreadExt {
    // Required method
    fn get_native_id(&self) -> Result<ThreadId, Error>;

    // Provided methods
    fn get_priority(&self) -> Result<ThreadPriority, Error> { ... }
    fn set_priority(&self, priority: ThreadPriority) -> Result<(), Error> { ... }
    fn set_ideal_processor(
        &self,
        ideal_processor: IdealProcessor
    ) -> Result<IdealProcessor, Error> { ... }
    fn set_priority_boost(&self, enabled: bool) -> Result<(), Error> { ... }
}
Expand description

Windows-specific complemented part of the crate::ThreadExt trait.

Required Methods§

source

fn get_native_id(&self) -> Result<ThreadId, Error>

Returns current thread’s windows id. For more info see thread_native_id.

use thread_priority::*;

assert!(!std::thread::current().get_native_id().unwrap().is_null());

Provided Methods§

source

fn get_priority(&self) -> Result<ThreadPriority, Error>

Returns current thread’s priority. For more info see [thread_priority].

use thread_priority::*;

assert!(std::thread::current().get_priority().is_ok());
source

fn set_priority(&self, priority: ThreadPriority) -> Result<(), Error>

Sets current thread’s priority. For more info see set_current_thread_priority.

use thread_priority::*;

assert!(std::thread::current().set_priority(ThreadPriority::Min).is_ok());
source

fn set_ideal_processor( &self, ideal_processor: IdealProcessor ) -> Result<IdealProcessor, Error>

Sets current thread’s ideal processor. For more info see set_current_thread_ideal_processor.

use thread_priority::*;

assert!(std::thread::current().set_ideal_processor(0).is_ok());
source

fn set_priority_boost(&self, enabled: bool) -> Result<(), Error>

Sets current thread’s priority boost. For more info see set_current_thread_priority_boost.

use thread_priority::*;

assert!(std::thread::current().set_priority_boost(true).is_ok());

Implementations on Foreign Types§

source§

impl ThreadExt for Thread

Auto-implementation of this trait for the std::thread::Thread.

Implementors§