-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add level and edge triggered modes to the poller #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks overall ok, but I dislike the code duplication in error cases.
this makes stuff way more complicated, because it introduces (additional) cases where the set of file descriptors can become out-of-sync with the OS view of file descriptors (e.g. a file descriptor is closed, and a new one is opened with the same ID), where the reactor would need to be notified; on other OSes this is handled mostly automatically by the OS view the native interface (although |
I see, thanks for confirming the gut feeling I had as to why we shouldn't do this. However, if this is an issue, isn't the #51 is probably related. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks now ok overall.
But could we add some tests to make sure that it works?
It looks like there's an issue with |
Hmm, it looks like there's some subtlety with It's probably something obvious that I'm missing. I'll take another run at it in the morning. |
I think I've figured out the issue; sometimes, on At this stage, I think all of the issues with this PR are resolved. |
At the moment,
polling
only supports oneshot-triggered event polling. However, most of the backendspolling
uses also supports level-triggered operation and some even support edge-triggered operations. While oneshot polling works for theasync-io
usecase, other users may want to use other polling modes. This PR adds alternative polling modes and avenues to use to react if one isn't available.Note that we may be able to support level-triggered operation on Solarish, with some extra elbow grease. However, unless there's another way I couldn't see, the only way I could see to do this would be to keep track of the level-trigger file descriptors through a
HashSet
(wrapped in aMutex
) and that would add some performance burden to the polling operation.