Jump to content
  • Advertisement
Sign in to follow this  
akira32

How to transfer epoll to IOCP?

This topic is 2988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How to transfer epoll to IOCP?
I have some code using epoll in Linux. But now I want to change it to use IOCP.
Could sombody know how to transfer epoll to IOCP?

Share this post


Link to post
Share on other sites
Advertisement
- use CreateIoCompletionPort with INVALID_HANDLE_VALUE instead of epoll_create.
- use CreateIoCompletionPort with a file or socket handle to associate that handle with this port (your IOCP's handle goes into ExistingCompletionPort).
- use GetQueuedCompletionStatus instead of epoll_wait
- use PostQueuedCompletionStatus if you need to manually post a message (for inter-thread communication or such)
- forget signals and epoll_pwait, no such thing to worry about
- if you need to remove a handle and assign it to another IOCP (which is simple with epoll), you're screwed
- if you need several IOCPs to monitor the same handle, you're screwed
- be aware that IOCP works differently from epoll in that it wakes up exactly one thread, not every thread that blocks

All above funcitons are well-documented on MSDN, simply type one of them into Google to find the MSDN page.

Share this post


Link to post
Share on other sites
All I know about epoll is from the internet. The Kernel man pages are surprisingly good and accurate.
However, you have to pay attention to the smallprint -- although everything is documented, it is not always immediately obvious (e.g. when it says a regular file will always be ready, this means you can't directly use epoll with a regular file in a meaningful manner).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!