Yeah, that is exactly what I'm talking about (while loop like that). Not that it needs to be infinite to be harmful, but long running would starve the other threads.
A filter/map/reduce with an array.sort() could be harmful enough, depending on the size of the data set. I'll know soon enough :) On Jul 2, 2012, at 6:18 AM, Stephan Beal wrote: > On Mon, Jul 2, 2012 at 3:11 PM, Michael Schwartz <[email protected]> wrote: > However, a long running thread could call sleep(0) or pthread_yield() > periodically to allow the other threads to run. > > From what i understand, every time the JS-side code calls back into v8 (e.g. > via a function call), v8 gets a chance to interrupt it. This doesn't protect > against infinite loops which don't call back into v8, of course. > while(true){++i} would "probably" never yield. > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > http://gplus.to/sgbeal > > > -- > 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
