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
This PR adds a `setInterval` implementation. This is largely copied over
from the related change in Babylon Native:
BabylonJS/BabylonNative@b2d5b2e#diff-23ceed54341331df9f4df6a9141772cd3613446bef20c7d96c62f5bebdbcf426
However, with the tests, I did discover a pre-existing timing/threading
problem. Specifically, if the callback was scheduled in the JS thread
via `m_runtime.Dispatch`, it is possible that the JS code could call
`clearTimeout` before the dispatched callback is executed. This would
result in the callback being called even after a call to `clearTimeout`.
This became more obvious with `setInterval`, especially with small
intervals. I changed the logic so that now the entries are removed from
the time map on the timer thread, but the entries in the timer id map
are left in place and removed only by calls on the JS thread - either a
call to `clearTimeout`, or in the callback on the JS thread. This way,
we know for sure in the callback on the JS thread whether the timer has
been cleared.
---------
Co-authored-by: Ryan Tremblay <[email protected]>
0 commit comments