@@ -19,7 +19,6 @@ pub(crate) mod _signal {
1919
2020 cfg_if:: cfg_if! {
2121 if #[ cfg( windows) ] {
22- use winapi:: um:: winsock2;
2322 type WakeupFd = libc:: SOCKET ;
2423 const INVALID_WAKEUP : WakeupFd = ( -1isize ) as usize ;
2524 static WAKEUP : atomic:: AtomicUsize = atomic:: AtomicUsize :: new( INVALID_WAKEUP ) ;
@@ -200,14 +199,16 @@ pub(crate) mod _signal {
200199
201200 #[ cfg( windows) ]
202201 let is_socket = if fd != INVALID_WAKEUP {
202+ use windows_sys:: Win32 :: Networking :: WinSock ;
203+
203204 crate :: stdlib:: nt:: init_winsock ( ) ;
204205 let mut res = 0i32 ;
205206 let mut res_size = std:: mem:: size_of :: < i32 > ( ) as i32 ;
206207 let res = unsafe {
207- winsock2 :: getsockopt (
208+ WinSock :: getsockopt (
208209 fd,
209- winsock2 :: SOL_SOCKET ,
210- winsock2 :: SO_ERROR ,
210+ WinSock :: SOL_SOCKET ,
211+ WinSock :: SO_ERROR ,
211212 & mut res as * mut i32 as * mut _ ,
212213 & mut res_size,
213214 )
@@ -217,7 +218,7 @@ pub(crate) mod _signal {
217218 if !is_socket {
218219 let err = std:: io:: Error :: last_os_error ( ) ;
219220 // if getsockopt failed for some other reason, throw
220- if err. raw_os_error ( ) != Some ( winsock2 :: WSAENOTSOCK ) {
221+ if err. raw_os_error ( ) != Some ( WinSock :: WSAENOTSOCK ) {
221222 return Err ( err. into_pyexception ( vm) ) ;
222223 }
223224 }
@@ -263,8 +264,14 @@ pub(crate) mod _signal {
263264 let sigbyte = signum as u8 ;
264265 #[ cfg( windows) ]
265266 if WAKEUP_IS_SOCKET . load ( Ordering :: Relaxed ) {
266- let _res =
267- unsafe { winsock2:: send ( wakeup_fd, & sigbyte as * const u8 as * const _ , 1 , 0 ) } ;
267+ let _res = unsafe {
268+ windows_sys:: Win32 :: Networking :: WinSock :: send (
269+ wakeup_fd,
270+ & sigbyte as * const u8 as * const _ ,
271+ 1 ,
272+ 0 ,
273+ )
274+ } ;
268275 return ;
269276 }
270277 let _res = unsafe { libc:: write ( wakeup_fd as _ , & sigbyte as * const u8 as * const _ , 1 ) } ;
0 commit comments