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.
badmintonbaseba|1 year ago
edit: Oh, it uses `signal.set_wakeup_fd`, interesting.
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/bf21e2160d1dc6869fb23...
gpderetta|1 year ago
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|1 year ago