[uv_async_send] Not executed in main loop?

34 views
Skip to first unread message

Thomas Barusseau

unread,
Dec 5, 2016, 7:22:49 AM12/5/16
to v8-users
Hello,

I'm not sure this is the right group to post in since I'm relying heavily on
libuv and nan, although everything works on v8, so...

I'm basically using a node function callback (in this case, process.emit)
in C++ code. Whenever the C++ callback method is called, I call the node
function with the appropriate arguments.

Here is the code I'm running, and it works fine :

However, one things bothers me, and it's specifically about the `process.emit`
method. I feel like the function called by uv_async_send isn't being executed
in node's main event loop. I think this because when running this code in node,
the callback I set at line 36 is never called.

If I replace "process.emit" by "console.log", it prints my arguments just fine.
The fact that "process.emit" will only be reacted to by listeners of the same
event loop is what makes me think that the work sent by uv_async_send isn't
being run in the main loop.

Could you confirm this and help me fix this? Thanks in advance,
and again, sorry if it's not posted in the right group.
Reply all
Reply to author
Forward
0 new messages