Skip to content

Commit 6f875a1

Browse files
committed
try support lock
1 parent 0d84102 commit 6f875a1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

hook/src/syscall/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use libc::{
22
fd_set, iovec, mode_t, msghdr, off_t, pthread_cond_t, pthread_mutex_t, size_t, sockaddr,
33
socklen_t, ssize_t, timespec, timeval,
44
};
5-
use std::ffi::{c_char, c_int, c_uint, c_void};
65
#[cfg(target_os = "macos")]
76
use std::cell::Cell;
7+
use std::ffi::{c_char, c_int, c_uint, c_void};
88
#[cfg(target_os = "macos")]
99
use std::sync::atomic::{AtomicPtr, Ordering};
1010

hook/src/syscall/windows.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ unsafe fn attach() -> std::io::Result<()> {
127127
impl_hook!("ws2_32.dll", SELECT, select(nfds: c_int, readfds: *mut FD_SET, writefds: *mut FD_SET, errorfds: *mut FD_SET, timeout: *mut TIMEVAL) -> c_int);
128128
impl_hook!("ws2_32.dll", WSAPOLL, WSAPoll(fds: *mut WSAPOLLFD, nfds: c_uint, timeout: c_int) -> c_int);
129129

130-
// WaitOnAddress is hooked manually (instead of via impl_hook!) because
131-
// once_cell::sync::OnceCell must be pre-initialised in attach() before any hook
132-
// is active, so that get() in the hook never needs to call get_or_init (which would
133-
// use parking_lot and recurse). The NioWaitOnAddressSyscall now yields via
134-
// suspender.until() rather than EventLoops::wait_event(), so no re-entrancy guard
135-
// is needed here.
130+
// WaitOnAddress is hooked manually (instead of via impl_hook!) because
131+
// once_cell::sync::OnceCell must be pre-initialised in attach() before any hook
132+
// is active, so that get() in the hook never needs to call get_or_init (which would
133+
// use parking_lot and recurse). The NioWaitOnAddressSyscall now yields via
134+
// suspender.until() rather than EventLoops::wait_event(), so no re-entrancy guard
135+
// is needed here.
136136
_ = WAITONADDRESS.get_or_init(|| unsafe {
137137
let syscall: &str =
138138
open_coroutine_core::common::constants::SyscallName::WaitOnAddress.into();

0 commit comments

Comments
 (0)