in reply to Is it OK for Time::HiRes::time() to report the time differently per thread?

Sorry, looks like replacing time() with clock_gettime(CLOCK_MONOTONIC) fixes the issue. Should have googled better first. I forgot to say, there's supposed to be another synchronised section in place of the 2nd "printf", hence my concern.

Replies are listed 'Best First'.
Re^2: Is it OK for Time::HiRes::time() to report the time differently per thread?
by ikegami (Patriarch) on Apr 23, 2026 at 16:26 UTC

    That doesn't fix your bug. The race condition is still present even if you didn't see a failure.