0

Suppose that I make several GET requests via jQuery's get function call. Will the callbacks provided as an argument to these function calls be fired in the same thread or can they be called at the same time, so I need some kind of synchronization for shared variables?

FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
  • Can fire off numerous requests ... order they return though will be unknown since they are asynchronous. You need to provide more details on objective – charlietfl Feb 14 '16 at 23:35
  • The callbacks are called in order (although unknown) and not in parallel. Unless you use Workers or something like that. – MinusFour Feb 14 '16 at 23:36
  • Possible duplicate of [Is javascript single-threaded?](http://stackoverflow.com/questions/9726098/is-javascript-single-threaded) – Alexander O'Mara Feb 14 '16 at 23:37
  • Normally javascript is single threaded. All your code will run in the same thread. The only exception to that is webworkers. However webworkers are designed such that synchronization is never necessary since you are never able to access the same memory from two different threads at the same time. – Tesseract Feb 14 '16 at 23:38
  • Duplicate [Is JavaScript multithreaded?](http://stackoverflow.com/questions/1663125/is-javascript-multithreaded) ? – k4yaman Feb 14 '16 at 23:38
  • check here if it helps -- http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done – Tasos Feb 14 '16 at 23:42

0 Answers0