Set process priority to high on windows
This commit is contained in:
parent
63cb7a4835
commit
c84531e70e
|
@ -1922,6 +1922,7 @@ dependencies = [
|
||||||
"rubato",
|
"rubato",
|
||||||
"thread-priority",
|
"thread-priority",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
|
"windows 0.58.0",
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ thread-priority = "1"
|
||||||
wgpu = "23.0"
|
wgpu = "23.0"
|
||||||
winit = "0.30"
|
winit = "0.30"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
windows = { version = "0.58", features = ["Win32_System_Threading"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1"
|
cc = "1"
|
||||||
|
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -19,7 +19,19 @@ struct Args {
|
||||||
rom: Option<PathBuf>,
|
rom: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn set_process_priority_to_high() -> Result<()> {
|
||||||
|
use windows::Win32::{Foundation, System::Threading};
|
||||||
|
let process = unsafe { Threading::GetCurrentProcess() };
|
||||||
|
unsafe { Threading::SetPriorityClass(process, Threading::HIGH_PRIORITY_CLASS)? };
|
||||||
|
unsafe { Foundation::CloseHandle(process)? };
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
#[cfg(windows)]
|
||||||
|
set_process_priority_to_high()?;
|
||||||
|
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
let (mut builder, client) = EmulatorBuilder::new();
|
let (mut builder, client) = EmulatorBuilder::new();
|
||||||
|
|
Loading…
Reference in New Issue