You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emscripten_get_now() is not monotonic in Safari with pthreads: performance.timeOrigin changes between reads #28271
In Safari (WebKit), performance.timeOrigin is recomputed on every read and changes between reads in cross-origin isolated contexts, which pthreads require. As a result, emscripten_get_now() goes backwards by up to ~0.2 ms, many thousands of times per second. Code that assumes a monotonic clock breaks.
This was introduced by #18267 (3.1.28). Possibly related: #18677 (Safari-only periodic glitch in a pthreads app, bisected to 3.1.27 -> 3.1.28).
Proposed fix: Read performance.timeOrigin once per thread. Per HR-Time it is constant for a global, so this matches the spec, keeps threads synchronized to the same base, and avoids the WebKit behaviour.
Activity
Read performance.timeOrigin once per thread in emscripten_get_now
Read performance.timeOrigin once per thread in emscripten_get_now
Read performance.timeOrigin once per thread in emscripten_get_now
Read performance.timeOrigin once per thread in emscripten_get_now
Read performance.timeOrigin once per thread in emscripten_get_now (em…