2010/1/15 Colin <[email protected]> > Awesome. Well, I'm considering using v8::Locker to run multi-thread JS > while scripts are waiting at various IO sleeps. Is there any issue > with having one context used by multiple threads simultaneously (w > locking of course) during these sleeps? JS will only be executing only > one at a time, but the execution point will be bouncing all around the > place =\ > > So say for example (in JS): > > function handle_req(data) { > yada(); > sleep(100); > yada2(); > } > > I basically want to run another handle_req (different thread, same > context) while this once is at its sleep point. Possible? >
This should be fine. Contexts and threads are orthogonal in V8. But if you are using V8 to do slow IO server-side then you should consider node.js. Might save you a lot of work. > > > On Jan 15, 2:15 am, Erik Corry <[email protected]> wrote: > > 2010/1/15 Colin <[email protected]> > > > > > I am going to be using v8 in a multi process environment. When's the > > > best time to fork? After creating a context? > > > > Probably the later you fork the better performance will be. Certainly > > creating a context and then forking will be faster than forking and then > > creating a context. Context creation takes around 2ms at the moment. > > > > -- > > Erik Corry > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users >
-- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
