mirror of https://github.com/stjepang/smol
Simplify
This commit is contained in:
parent
3f2945c94c
commit
61f52189b7
|
@ -47,7 +47,6 @@ optional = true
|
|||
libc = "0.2.70"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
miow = "0.3.5"
|
||||
wepoll-binding = "2.0.2"
|
||||
winapi = { version = "0.3.8", features = ["ioapiset"] }
|
||||
[patch.crates-io]
|
||||
|
|
|
@ -72,27 +72,16 @@ impl IoEvent {
|
|||
|
||||
#[cfg(windows)]
|
||||
pub fn notify(&self) {
|
||||
use std::os::windows::io::*;
|
||||
use std::mem::*;
|
||||
use std::os::windows::io::*;
|
||||
use winapi::um::ioapiset::PostQueuedCompletionStatus;
|
||||
use winapi::um::minwinbase::OVERLAPPED;
|
||||
use miow::iocp::*;
|
||||
use miow::*;
|
||||
|
||||
let reactor = crate::reactor::Reactor::get();
|
||||
let handle = reactor.sys.0.as_raw_handle();
|
||||
|
||||
atomic::fence(Ordering::SeqCst);
|
||||
unsafe {
|
||||
let port = ManuallyDrop::new(CompletionPort::from_raw_handle(handle));
|
||||
let status = CompletionStatus::zero();
|
||||
port.post(status);
|
||||
|
||||
// PostQueuedCompletionStatus(
|
||||
// 0,
|
||||
// 0,
|
||||
// zero as *const OVERLAPPED as *mut OVERLAPPED,
|
||||
// );
|
||||
PostQueuedCompletionStatus(reactor.sys.0.as_raw_handle(), 0, 0, 0 as *mut _);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1205,13 +1205,7 @@ static int port__feed_events(port_state_t* port_state,
|
|||
(IO_STATUS_BLOCK*) iocp_events[i].lpOverlapped;
|
||||
struct epoll_event* ev = &epoll_events[epoll_event_count];
|
||||
|
||||
if (io_status_block)
|
||||
epoll_event_count += sock_feed_event(port_state, io_status_block, ev);
|
||||
else {
|
||||
ev->events = 0;
|
||||
ev->data = 1000000;
|
||||
epoll_event_count += 1;
|
||||
}
|
||||
epoll_event_count += sock_feed_event(port_state, io_status_block, ev);
|
||||
}
|
||||
|
||||
return epoll_event_count;
|
||||
|
|
Loading…
Reference in New Issue