Closed dementcore closed 1 year ago
Hi @dementcore,
The Interrupt
method isn't "async-aware". When called, it does nothing if the engine isn't executing script code. The best you can do is "awake" the script code by setting your task to a completed state.
Cheers!
Thanks for your answer.
If you uncomment the line taskCompletionSource.SetResult
the script “awakes” but is not interrupted and ends normally.
It should get interrupted inmediately, right?
The SetResult
call triggers synchronous re-entry into main
, which then returns before you call Interrupt
.
Hi @ClearScriptLib!! Now i understand it. Thank you very much for your answer.
Hello!! Is there a way to interrupt execution when is async operations waiting or after an await?
In this example code (console project) the scripts never ends if the line
taskCompletionSource.SetResult("input from host");
is commented. If the linetaskCompletionSource.SetResult("input from host");
is uncommented the script ends normally and is not interrupted.I´m doing something wrong or this is a bug?
Tested on Microsoft.ClearScript.V8.Native.win-x64 v7.3.5