mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-12-01 12:20:59 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebb3182a6e |
@@ -34,11 +34,11 @@ use crate::quantity::{nanosecond, Information, Time, Zero};
|
|||||||
|
|
||||||
#[cfg(not(feature = "windows_process_extensions_main_thread_handle"))]
|
#[cfg(not(feature = "windows_process_extensions_main_thread_handle"))]
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
static NtResumeProcess: Lazy<unsafe extern "system" fn(ProcessHandle: HANDLE) -> NTSTATUS> =
|
static NtResumeProcess: Lazy<unsafe extern "system" fn(process_handle: HANDLE) -> NTSTATUS> =
|
||||||
Lazy::new(|| {
|
Lazy::new(|| {
|
||||||
// SAFETY: Getting the module handle for ntdll.dll is safe
|
// SAFETY: Getting the module handle for ntdll.dll is safe
|
||||||
let ntdll = unsafe { GetModuleHandleW(w!("ntdll.dll")) };
|
let ntdll = unsafe { GetModuleHandleW(w!("ntdll.dll")) };
|
||||||
assert!(ntdll != std::ptr::null_mut(), "GetModuleHandleW failed");
|
assert!(!ntdll.is_null(), "GetModuleHandleW failed");
|
||||||
|
|
||||||
// SAFETY: The ntdll handle is valid
|
// SAFETY: The ntdll handle is valid
|
||||||
let nt_resume_process = unsafe { GetProcAddress(ntdll, s!("NtResumeProcess")) };
|
let nt_resume_process = unsafe { GetProcAddress(ntdll, s!("NtResumeProcess")) };
|
||||||
@@ -57,10 +57,7 @@ impl CPUTimer {
|
|||||||
|
|
||||||
// SAFETY: Creating a new job object is safe
|
// SAFETY: Creating a new job object is safe
|
||||||
let job_object = unsafe { CreateJobObjectW(ptr::null_mut(), ptr::null_mut()) };
|
let job_object = unsafe { CreateJobObjectW(ptr::null_mut(), ptr::null_mut()) };
|
||||||
assert!(
|
assert!(!job_object.is_null(), "CreateJobObjectW failed");
|
||||||
job_object != std::ptr::null_mut(),
|
|
||||||
"CreateJobObjectW failed"
|
|
||||||
);
|
|
||||||
|
|
||||||
// SAFETY: The job object handle is valid
|
// SAFETY: The job object handle is valid
|
||||||
let ret = unsafe { AssignProcessToJobObject(job_object, child_handle) };
|
let ret = unsafe { AssignProcessToJobObject(job_object, child_handle) };
|
||||||
|
|||||||
Reference in new issue
Block a user