anuragsoni / poll

Portable OCaml interface to macOS/Linux/Windows native IO event notification mechanisms
https://anuragsoni.github.io/poll/poll
MIT License
31 stars 1 forks source link

Fix Event.write to have writable = true #15

Closed edwintorok closed 1 year ago

edwintorok commented 1 year ago

I was testing the library and my code got "stuck", I tried using Poll.set mux socket Poll.Event.write to handle EINPROGRESS from connect, but strace was showing that the FD was not getting added to the epoll set. This was because the code thought no change was requested, since Event.write was equal to Event.none.

edwintorok commented 1 year ago

Thanks for merging, there are still some other problems, e.g. 'oneshot' seems to be added to each event, so now after one event everything is still stuck.... (unless I keep changing epoll set)

anuragsoni commented 1 year ago

I’ve been thinking about allowing users to specify one shot vs level triggered events. Both kqueue and epoll support it so this seems like an option worth surfacing. I liked the idea of one shot events so a readiness event is only reported once instead of multiple times, and then considering file descriptors always ready unless encountering EAGAIN

edwintorok commented 1 year ago

Giving control the user sounds right, I have no experience with kqueue though, so I"ll leave that improvement idea to you.