I was looking at this tool suite and the old android tool "makeparallel" and noted in the android source https://android.googlesource.com/platform/build/+/refs/tags/platform-tools-29.0.2/tools/makeparallel/makeparallel.cpp#254
// The file descriptor can't be set to O_NONBLOCK as that would affect
// all users of the pipe, including the parent make process.
As seen in jobcount.c:20 , it sets O_NONBLOCK and also never resets it. I think this would be a issue for anything else using the jobserver.
I suggest using the same approach as makeparallel did, to do blocking reads with a short alarm that will kick the reader out of the blocking state upon block.
I was looking at this tool suite and the old android tool "makeparallel" and noted in the android source https://android.googlesource.com/platform/build/+/refs/tags/platform-tools-29.0.2/tools/makeparallel/makeparallel.cpp#254
As seen in jobcount.c:20 , it sets O_NONBLOCK and also never resets it. I think this would be a issue for anything else using the jobserver.
I suggest using the same approach as makeparallel did, to do blocking reads with a short alarm that will kick the reader out of the blocking state upon block.