On Sat, Apr 9, 2016 at 12:50 AM, Felix Kiechle <[email protected]> wrote:
> http://stackoverflow.com/questions/36490779/node-architecture-is-libuvs-event-loop-exposed-to-v8
>
> At the end of this article (section EventLoop) it says that libuv's event 
> loop is passed to V8. On the first reading that seemed to make sence: In the 
> browser V8 has it's own event loop, in Node it gets that of libuv. But then I 
> started digging into the code and couldn't find a proof where the loop is 
> passed to V8.
>
>
> StartNodeInstance leads after some steps to the creation of a new Environment 
> instance. The constructor is passed a newly created V8 Context, which is 
> created from a V8 isolate, as well as a pointer to the libuv default loop.
>
> Then the loop is passed to the creation of a IsolateData instance. I couldn't 
> find a hint that the loop is actually passed or registered to V8. Nor that 
> the Environment::New belongs to the V8 namespace, as said at the end of the 
> article.
>
>
> An isolate is a V8 VM instance with its own heap. A context is an execution 
> environment that allows separate, unrelated, JavaScript code to run in a 
> single instance of V8. You must explicitly specify the context in which you 
> want any JavaScript code to be run.

Newer versions of V8 have a concept of an event loop
(`v8::platform::PumpMessageLoop()`) that's used to drive the
micro-task queue for promise and observer events.

However, it's incorrect to say that node.js passes the libuv event
loop handle to V8.  V8 is unaware of the existence of libuv, it merely
gets called by the embedder from time to time.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to