Hi, I have a native method running in its own thread and calling a callback to post its status. The callback has some user data that I'd like to post to JS. Since the callback is running in a different thread than v8, I can't use any v8 method to call a JS callback function. So I wonder if there is a way to use some persistent objects to do that?
One solution I found is to use queue the native method using libuv. This way, I can use a busy wait in uv's Work callback method until my native method's callback is called. Then uv's Work callback proceed and I can use uv's After callback to call the JS callback method, as usual. While this seems to work, it still looks like very hack-ish. Is there a better solution/pattern? Thanks