On Mon, Oct 07, 2024 at 01:58:21AM -0400, Jeff King wrote: > I think your patch has one small bug, which is that you don't > pthread_mutex_destroy() at the end of fsmonitor_run_daemon(). But other > than that I think it should work OK (I haven't tried it in practice yet; > I assume you did?). I just checked your patch in our CI, using the sleep(1) you suggested earlier to more predictably lose the race(). It does work reliably (and I confirmed with some extra trace statements that it does spin on the sleep_millisec() loop). I had also previously checked my suggested solution. So I do think either is a valid solution to the problem. -Peff