[Javascript] atomic operations

liorean liorean at gmail.com
Sat May 6 16:14:10 CDT 2006


On 03/05/06, Andrew Clover <and-babble at doxdesk.com> wrote:
> This makes perfect sense and *should* be what happens. Except, it isn't
> always.
>
>  From bitter experience I know of two particular cases where it does not:

/snip/

> So whilst normally you don't have to worry about threading/re-entrancy
> in JS, there are times when it can be an issue, and the whole issue
> doesn't seem to be documented anywhere. Would be interested to hear
> anything more definitive on this issue because it's a pretty basic part
> of JavaScript that's usually taken for granted.

<pure:speculation>
Well, my guess is that the problem here is that we have an outside
code asynchronously halting the JavaScript execution. While the
JavaScript execution of a code block is halted, it's effectively
removed from the event queue and the engine is freed up to execute
anything appearing on the event queue. When the outside code resumes
the script, the resumption of that code block will be placed on the
event queue. However, through it all the JavaScript engine only does
serial execution.
</pure:speculation>

I'll try to probe my contacts to see if I can get an answer from
someone involved with the internals though.
--
David "liorean" Andersson
<uri:http://liorean.web-graphics.com/>



More information about the Javascript mailing list