This page demonstrates the JavaScript thread library in thread.js.
By starting the thread test, two thread are created. One of them (the
source) increments a shared counter. The other one (the sink) decrements
the counter. By pressing the start button during the benchmark run, the shared
counter is interactively decremented from the event handler.
One can observe, that the lock acquisition never fails (in both, IE and FF).
From that, one can conclude that in both browsers onclick
handlers and timers are executed in a single thread. However, there is evidence
that IE executes some handlers concurrently in different threads. See
the window open test. Using explicit lock objects
from the tread library seems to be necessary only if code might be executed
concurrently from "regular" handlers and those dangerous handlers, one of which
seems to be the onload handler.