[Javascript] Javascript and threads

liorean liorean at gmail.com
Mon May 28 11:39:31 CDT 2007


On 28/05/07, twlewis at softhome.net <twlewis at softhome.net> wrote:
> Can threads be implemented in Javascript (such as nsIThread)?

That depends a little bit on what you mean by a "thread". If you mean
OS level threads, for utilising maximum CPU, then no. If you mean
concurrency through cooperative threading of a program running in a
single OS thread, then yes. There are a number of different solutions
to cooperative threading, most utilising a task queue and some form of
trampoline using either exceptions, timers or an indefinite loop.
-- 
David "liorean" Andersson



More information about the Javascript mailing list