Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Er, I'm not sure what you were reading, but Windows has a poll function. It's called poll. Overlapped I/O is the edge-trigged notifications you want, and correspond to epoll/kqueues. You make a function call, which returns immediately. You then get a callback (either literally, if you're on .NET, or as a Windows event otherwise) when data is available. Overlapped I/O automatically uses the Windows thread pools, so making my own wouldn't make sense.


Native Windows overlapped I/O can give you a callback without needing to use an event: WriteFileEx (or WSASend) accepts a callback routine, etc. Also, the OVERLAPPED structure requires you to provide the event handle, and it's optional, so you don't need to use that kernel resource if you don't want to.

The "poll" function you speak of - I presume you mean Socket.Poll - is spelled "select" in native code, and is equivalent to the BSD sockets version.


We're getting a bit knit-picky, but yes, you can get a callback directly--which is in fact what we're doing.

Vista and later (which includes Windows 2k8 Server) actually introduces a proper WSAPoll function, so you don't need to use the godawful select() anymore unless being masochistic really is just your thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: