r/javascript • • Oct 29 '10

c# programmer: JavaScript is "completely single threaded and blocking" in relation to fetching from a URL.

/r/programming/comments/dxv7a/asynchrony_in_c_5_part_one/c13rj6k
0 Upvotes

26 comments sorted by

View all comments

7

u/wendall911 Oct 29 '10

Reminded me of this blog entry: http://ejohn.org/blog/how-javascript-timers-work/ It's a fine illustration through a feature on how JS is single threaded and blocking.

Here is a excerpt:

Since JavaScript can only ever execute one piece of code at a time (due to its single-threaded nature) each of these blocks of code are "blocking" the progress of other asynchronous events. This means that when an asynchronous event occurs (like a mouse click, a timer firing, or an XMLHttpRequest completing) it gets queued up to be executed later (how this queueing actually occurs surely varies from browser-to-browser, so consider this to be a simplification).

4

u/BusStation16 Oct 29 '10

This is an excerpt from my work-in-progress book: Secrets of the JavaScript Ninja. To be released Fall 2008.

...still waiting

3

u/jimrhoskins Oct 29 '10

http://www.manning.com/resig/

You can read (most of) it now.