Skip to content

Commit

Permalink
Merge pull request #378 from kennykerr/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Apr 13, 2023
2 parents f75d948 + 7157879 commit 746df3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ libc = "0.2.95"
[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.3"

[target.'cfg(windows)'.dependencies]
windows-targets = "0.48.0"

[features]
nightly = []
deadlock_detection = ["petgraph", "thread-id", "backtrace"]
15 changes: 5 additions & 10 deletions core/src/thread_parker/windows/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ pub type WaitOnAddress = unsafe extern "system" fn(
) -> BOOL;
pub type WakeByAddressSingle = unsafe extern "system" fn(Address: *const std::ffi::c_void);

#[link(name = "kernel32")]
extern "system" {
pub fn GetLastError() -> u32;
pub fn CloseHandle(hObject: HANDLE) -> BOOL;

pub fn GetModuleHandleA(lpModuleName: *const u8) -> HINSTANCE;
pub fn GetProcAddress(hModule: HINSTANCE, lpProcName: *const u8) -> FARPROC;

pub fn Sleep(dwMilliseconds: u32);
}
windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> u32);
windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hObject: HANDLE) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn GetModuleHandleA(lpModuleName: *const u8) -> HINSTANCE);
windows_targets::link!("kernel32.dll" "system" fn GetProcAddress(hModule: HINSTANCE, lpProcName: *const u8) -> FARPROC);
windows_targets::link!("kernel32.dll" "system" fn Sleep(dwMilliseconds: u32) -> ());

0 comments on commit 746df3e

Please sign in to comment.