Async Unsafe Callback?
Is it possible to create a unsafe callback on a async function?
I need the native program to wait for a response from async function before continuing!
2 Replies
Somthing like this!
No, this is not possible as it would (in the general case) require cooperation from the caller.
The only case when this would be possible without cooperation from the caller is when the caller performs this callback from a foreign thread: In that case we can block that foreign thread while we perform the asynchronous work on the main thread.
But if the exact same call is performed on the main thread, there is no way to (unilaterally) block the main thread for the caller while still using the main thread to perform the asynchronous JavaScript work.