20. aug. 2010 00.38 skrev malcolm handley <[email protected]>: > I'm looking into adding to v8 support for fibers or cooperatively > scheduled threads. I've read a bunch of posts on v8 and threading so > far and my understanding is that it's ok to have multiple threads > executing v8 code as long as they hold V8::Locker when they do so > (and, hence, that only one of them is executing v8 code at a time). > > Is this correct? Are there any pitfalls I should be aware of or > reasons that this is a non-starter?
I think it could be made to work. If you plan to have a very large number of fibers you should be aware that normal JS programs can use a lot of stack space if the programmer makes use of Function.prototype.apply. This will unfold an array onto the stack in the current implementation. Eddy's comment looks right too. I can't of course make any guarantees about your chances of getting such a change upstreamed. As always with these things having the change be nicely encapsulated, non-intrusive and performance neutral for those that don't use it will help. -- Erik Corry, Software Engineer Google Denmark ApS - Frederiksborggade 20B, 1 sal, 1360 København K - Denmark - CVR nr. 28 86 69 84 -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
