thread_priority::windows

Trait 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§