Tests 0 and 4 and possibly later tests put my laptop in space-heater mode, using 100% CPU without making apparent progress. (I'm on macOS 12.5 Monterey.) Sampling the process with Activity Monitor shows that it is spending almost all its time in os_stat. This suggests to me that there is code somewhere that waits for the status of a file to change within a spin loop. Of course, on a POSIX system os_stat could be used on something other than a file, like a pipe or a socket for example. I'm not savvy enough to tell if this is the case just by looking at the data given by Activity Monitor.
Tests 0 and 4 and possibly later tests put my laptop in space-heater mode, using 100% CPU without making apparent progress. (I'm on macOS 12.5 Monterey.) Sampling the process with Activity Monitor shows that it is spending almost all its time in
os_stat. This suggests to me that there is code somewhere that waits for the status of a file to change within a spin loop. Of course, on a POSIX systemos_statcould be used on something other than a file, like a pipe or a socket for example. I'm not savvy enough to tell if this is the case just by looking at the data given by Activity Monitor.