It really is. Tonight I had the idea of trying out something crazy with epoll. I tried out what happens if you modify the flags of a fd in a thread while the epoll.poll call is blocking the main one. I didn't really expect it to mind the changes done by the thread but - unlike poll - epoll does. This is really nifty and I am sure can be put to good use (though I have to admit I cannot think about one just yet). What perplexes me is that this is not documented - neither in the (rather sparse) Python documentation of select.epoll, nor in the Linux manpage for epoll. All I could find was a "They are thread safe", but that's in an a bit different context.
I'm thinking about creating an API for asynchia that abstracts changes the the socket-map from other threads (you are not expected to understand this if you are not familiar with asynchia).
I have also written code that illustrates how this works with epoll, and how it does not with poll.
No comments:
Post a Comment