Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad interrupt handling in Javascript #1447

Closed

Conversation

benkuper
Copy link

This proposes a fix for the issue #1445

The execute() function sets an interrupt in the engine that is then checked whenever a function is called using callFunction, but the interval in the interrupt check function is calculated depending on the time at execute(), not the time at callFunction(), resulting in an inevitable interrupt if we keep calling functions after having calling execute() once.

This fix store a "timeAtLastStart" variable that replaces the lambda-local "started" argument. This way, it is effectively updated everytime an evaluate / execute / callFunction is used, without having to redefine the engine interrupt handler everytime.

A more complete and possibly elegant implementation would be to keep track of which thread has called what and have different checks for each thread, so they can be treated independently. But this fix is way simpler and should be good for most cases.

This also updates the UnitTest to include those types
@benkuper benkuper closed this Oct 17, 2024
@benkuper benkuper deleted the bugfix/javascriptInterrupt branch October 17, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant