I've never worked on a really complex project using JS, but I'll
contribute with my amateur views anyway:

All JS engines are single-threaded, one less thing to worry about :]

The exception is of course, AJAX calls which are asynchronous, they
are technically not executing at the same time, but you can have the
callbacks fire one instantly after the other. jQuery's "logic" for
events and DOM manipulation already protects you a bit from doing
something stupid.

The most likely situation to happen is one where callbacks are
executed multiple times and manipulate the DOM overriding each other's
changes. But that wouldn't crash the browser or anything, and it can
be prevented just by using well structured code, not allowing two
handlers to manipulate the same section of the page, or making sure
that subsequent Ajax calls whose functions overlap can cancel each
other.

I'm not an expert, but the main 4 reasons for a webapp to crash on js
are:

1. memory leaks
2. humongous DOM manipulation (likely would timeout)
3. too many event handlers
4. stupid things like infinite loops or a synchronous http request

- ricardo

On Dec 2, 12:42 am, László Monda <[EMAIL PROTECTED]> wrote:
> Hi List,
>
> My question is not specific to jQuery and I don't wanna be offtopic,
> but I post there because I think there are the brightest minds of the
> planet regarding JavaScript development.
>
> We're building a web2.0 application and there are some singleton
> objects and various AJAX event handlers that manipulate them.  I'm
> worried that race conditions can occur which have a potential to kill
> the client side.
>
> http://www.developer.com/lang/jscript/article.php/3592016- This is
> the most relevant article that I could find about avoiding race
> conditions in JavaScript, but I'm not really confident about its
> content and there's very little information accessible on
> multithreaded issues regarding JavaScript.
>
> So basically I'd like to get some clarifications on whether JavaScript
> is multithreaded and if so, how one can build rock solid code that
> don't mess up the client side.
>
> Thanks in advance,
> Laci  <http://monda.hu>

Reply via email to