I'm pretty sure this is what uv_async_t, uv_async_send and friends are for,
but somebody correct be if I am wrong.

On Fri, Mar 16, 2012 at 10:22 AM, m1k3l <[email protected]> wrote:

> 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
>

Reply via email to