[issue40485] Provide an abstraction for a select-able Event

2021-04-09 Thread Faidon Liambotis
Faidon Liambotis added the comment: Not sure if I understand the question! I'd like to see that happen, I don't particularly care if it makes to 3.10 or a later version, although of course the earlier the better :) As an idea of a path forward, would it make sense to take the code above

[issue40485] Provide an abstraction for a select-able Event

2021-04-09 Thread Faidon Liambotis
Faidon Liambotis added the comment: I missed that there is now also an os.eventfd_{write,read}(), so in the above os.write(self._event_fd, self._ONE) can become os.eventfd_write(self._event_fd, 1) and: os.read(self._event_fd, 8) can become: os.eventfd_read(self._event_fd

[issue40485] Provide an abstraction for a select-able Event

2021-04-09 Thread Faidon Liambotis
Faidon Liambotis added the comment: Thanks so much for all the work on os.eventfd(), it's exciting to see it come to fruition. An eventfd variant of Event (compatible with the threading & multiprocessing APIs) is now as simple as: class Event: _ONE = (1).to_bytes(8, byteo

[issue40485] Provide an abstraction for a select-able Event

2020-05-03 Thread Faidon Liambotis
New submission from Faidon Liambotis : In certain codebases, it's useful to be able to wait for input from one or more file descriptors (e.g. a socket), while at the same time waiting for an event triggered by another thread, or perhaps multiprocessing process. To wait for one or more file