-
Notifications
You must be signed in to change notification settings - Fork 180
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
Question about execution pause #768
Comments
Yes, I think what you want is the Debugging Interface (enabled through the flag |
Not exactly what you like to do. You have just described async, which Rhai is not. However, as @emesare mentioned, you can use the debugging interface or use the |
Thank you for pointing this out; I will certainly experiment with this idea. I envision a method where a host function, defined in Rust, is called by Rhai. This function would have the capability to suspend or yield the execution of Rhai at that specific point. After pausing and securely storing the context, an asynchronous task would be executed on the Rust side. Upon completion of this task, Rust would restore the previously stored context, allowing the Rhai script to resume execution seamlessly. |
You can probably do that easily by encapsulating a channel inside |
I have coded up an example: https://github.com/schungx/rhai/blob/master/examples/pause_and_resume.rs |
If you want such a |
Is there any way or workaround to pause the execution, store context and resume the execution and context from that point?
The text was updated successfully, but these errors were encountered: