[OpenLayers-Dev] threading/synchronicity in javascript
Nikolas Coukouma
atrus at atrus.org
Sat Nov 1 05:25:38 EDT 2008
2008/11/1 Erik Uzureau <euzuro at gmail.com>:
> Dear OpenLayers users & dev,
>
> Pardon the non-geo post, but I am wondering if anyone out there has come up
> across issues with
> synchronicity in javascript?
>
> After pouring over this stuff for several hours, I think I am pretty
> resolved to just say "ok, javascript
> is event-driven and not truly multithreaded, so there is no need to worry".
I can't comment on other implementations (MS IE/JScript,
Safari/WebKit, Opera), but in (Spidermonkey and now
Tracemonkey)/Firefox:
Javascript is only ever executed from one thread. There are other
threads, but they're primarily used for things like DNS lookup and
insert events that are handled by the main thread.
Execution of a piece of code *can* be preempted, but only at very
specific points, basically at the start and/or end of a block (e.g.
exiting a function or the top of a for loop).
More information about the Dev
mailing list