5 ms·
It's not even slightly tricky, just use self pipe. I have no idea why the maintainer of make rejected it. He says select has different signatures, but select is
by aumerle 2y ago
It's not even slightly tricky, just use self pipe. I have no idea why the maintainer of make rejected it. He says select has different signatures, but select is in POSIX, so unless he is porting to a non POSIX platform, it's irrelevant and even if he is, I doubt it is that hard to write a wrapper to abstract the non POSIX compatible implementation of select. Then he complains about needing to do CLOEXEC on the self pipe. This is trivial (one line) on Linux using pipe2 and about 5 lines of code on other platforms. Given that he says make does not use threads its also perfectly robust without pipe2.
Opting for a harder algorithm just to avoid a few lines of compatibility shims seems like very much the wrong tradeoff.
- gpderetta 2y ago> so unless he is porting to a non POSIX platform Very likely gmake works on non-posix platforms. Whether there is a requirement that the jobserver also works there I don't know. It also needs to work on non-linux platforms. So a portable solution (or multiple non-portable ones) is needed.
- aumerle 2y agoYes, but this is two well known and understood functions we are talking about, wrapping them is really not that hard.
- badmintonbaseba 2y agoI'm not seeing python creating a self-pipe for `loop.add_signal_handler`. edit: Oh, it uses `signal.set_wakeup_fd`, interesting. https://docs.python.org/3/library/signal.html#signal.set_wakeup_fd https://docs.python.org/3/library/signal.html#signal.set_wak... edit2: it looks like the fd comes from a self-socket, but yeah, it's the same approach. The function is even called `_make_self_pipe`. https://github.com/python/cpython/blob/bf21e2160d1dc6869fb230b90a23ab030835395b/Lib/asyncio/selector_events.py#L118-L124 https://github.com/python/cpython/blob/bf21e2160d1dc6869fb23...