Rollup merge of #145412 - tgross35:win-tid, r=ChrisDenton
Windows: Replace `GetThreadId`+`GetCurrentThread` with `GetCurrentThreadId` Reference: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadid
This commit is contained in:
commit
7c93af02e3
3 changed files with 3 additions and 3 deletions
|
|
@ -2158,6 +2158,7 @@ GetCurrentDirectoryW
|
|||
GetCurrentProcess
|
||||
GetCurrentProcessId
|
||||
GetCurrentThread
|
||||
GetCurrentThreadId
|
||||
GetEnvironmentStringsW
|
||||
GetEnvironmentVariableW
|
||||
GetExitCodeProcess
|
||||
|
|
@ -2185,7 +2186,6 @@ GetSystemInfo
|
|||
GetSystemTimeAsFileTime
|
||||
GetSystemTimePreciseAsFileTime
|
||||
GetTempPathW
|
||||
GetThreadId
|
||||
GetUserProfileDirectoryW
|
||||
GetWindowsDirectoryW
|
||||
HANDLE
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetCurrentDirectoryW(nbufferle
|
|||
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcess() -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcessId() -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetCurrentThread() -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetCurrentThreadId() -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentStringsW() -> PWSTR);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentVariableW(lpname : PCWSTR, lpbuffer : PWSTR, nsize : u32) -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetExitCodeProcess(hprocess : HANDLE, lpexitcode : *mut u32) -> BOOL);
|
||||
|
|
@ -61,7 +62,6 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : *
|
|||
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetThreadId(thread : HANDLE) -> u32);
|
||||
windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ impl Thread {
|
|||
|
||||
pub(crate) fn current_os_id() -> Option<u64> {
|
||||
// SAFETY: FFI call with no preconditions.
|
||||
let id: u32 = unsafe { c::GetThreadId(c::GetCurrentThread()) };
|
||||
let id: u32 = unsafe { c::GetCurrentThreadId() };
|
||||
|
||||
// A return value of 0 indicates failed lookup.
|
||||
if id == 0 { None } else { Some(id.into()) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue