Hello, thank you for your answer!
This sounds really amazing. I hope I find the resources to understand this some days. Could you recommend a good tutorial for learning c(++) so I can understand and play around with libuv (and later on understand the bindings you linked to)? Regards, Bodo Am 11.02.2013 um 16:34 schrieb Tim Caswell <[email protected]>: > The language itself has no I/O at all. Even setTimeout and setInterval are > implemented by the libuv bindings using uv_timer_t instances. In the browser > the language VM is bound to the browser natives and APIs. In node, the > language is bound to libuv and other natives that node exposes. > > As far as callbacks, *every* true event source must come from C somewhere. > JavaScript cannot create new event sources on it's own. You can create a > function that wraps an async source (like the uv_timer_t interface) and > exposes a different API in javascript (like setTimeout). > > In node, there are bindings providing all the I/O (timers, tcp, pipes, tty, > fs, udp, dns, etc) and some C bindings for operations that CPU intensive or > hard to implement (http parsing, crypto, compression, etc..) > > For specifics, here is the C++ <-> JavaScript binding bridge for uv_timer_t > https://github.com/joyent/node/blob/master/src/timer_wrap.cc . And here is > the JS API wrapper to expose this as the well known setTimeout interface: > https://github.com/joyent/node/blob/master/lib/timers.js#L180-L214 > > Hope this helps, let me know if you have more questions. There is a lot > going on here. > > -Tim Caswell > > > > > > On Mon, Feb 11, 2013 at 8:47 AM, Bodo Kaiser <[email protected]> wrote: > Hello, > > last weekend I asked how nodejs event loop worked and I became a great link > about it: http://nikhilm.github.com/uvbook/basics.html#event-loops > > Unfortunately I still got a major understanding problem about nodejs: > When we use some node modules which itself look like plain javascript then in > the background libuv has to handle them somehow (e.g. tcp sockets) but how > could I imagine this? > Does the javascript get parsed by v8 which detects defined classes and > informs libuv to do the tasks the overlaying tcp sockets are configured for? > And what is about some "normal" javascript-language callbacks (e.g. > setTimeout). Are they also handled by v8 or libuv? > > > I think I do not understand what the v8 engine does exactly and how the other > libs are bound into. Could somebody clarify me? > > Regards, > Bodo > > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
