Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 135733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:50:14+00:00 2026-05-11T06:50:14+00:00

As far as I understand, all JavaScript code is event-driven and executes on a

  • 0

As far as I understand, all JavaScript code is event-driven and executes on a single browser thread.

However, I have some JavaScript functions that are called from within a SWF object sitting on the same page. Is this code run in the same manner as regular JS code, or is it on some separate Flash thread?

If it is on a separate thread, can I use setTimeout() to get it to run on the JS events thread? e.g.:

function calledFromFlash() {     setTimeout(doActualWork, 0); }  function doActualWork() {     // blah blah blah } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:50:14+00:00Added an answer on May 11, 2026 at 6:50 am

    It’s still on the same thread. However, for most practical purposes if you have such a long-running JavaScript that you’re worried your ‘main’ task might block the call from setTimeout, you should consider revisiting your underlying approach.

    Update for the bounty:

    To expand on the more general question of threading in JavaScript, there is a great discussion with a very revealing answer from Bobince. He cites some very interesting scenarios that might call into question whether we can truly consider JS to be single-threaded, and his conclusion is ‘not quite’.

    The conclusion of the comments, which I agree with, is that from the perspective inside the JS runtime, the universe is single-threaded, but because the infrastructure surrounding the JS sandbox is not single-threaded, it can reach inside the sandbox and muck with state in unexpected ways. From inside the runtime, some unknown entity can ‘suspend the laws of nature’ and change things around. But the runtime has no threading construct to handle that scenario natively.

    I think the most important way to approach the question is to ask what do we mean by multi-threadedness in a practical scenario? Usually threading issues come down to things like synchronization, which we have to assume the browser vendors have solved for us because again, JavaScript has no native construct for even trying to deal with it ourselves. Hand-wringing about threading does no good without the tools to fix it; no mutexes or locks.

    So setting aside those kinds of catastrophic problems, we’re down to things like maybe a value gets changed out from under us unexpectedly. But well-written code should be OK with that. Even in Bobince’ example, all the code involved is still code that we voluntarily included in the page (even wrote ourselves) so sure, it might be surprising if that code gets fired while your main callstack is ostensibly ‘blocked’. But again speaking to practical problems, what is the worst thing you could do to yourself in that scenario? Nothing too serious.

    So that’s my long way of saying: I don’t know of any documentation from the browser vendors where they say unequivocally whether their JS implementation is single-threaded or not, but I question whether that matters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I understand, the onchange event of a text input element is
As far as I understand the branch-on-sign is the name of some kind of
I have a list in SharePoint 2010 with some columns. All are default types.
As far as I understand all sniffing libraries in .NET just a wrapper around
I'm trying to understand how all these tools work since, as far as I
folks, I have on my pages ( http://playdota.thilisar.cz ) a JavaScript file(code below), that
As far as I understand from the documentation the QUdpSocket are async but, still,
As far as I understand Facebook allowes you (through the API) to post on
As far as I understand, https is http plus SSL/TLS. What do I need
As far as I understand the serial port so far, transferring data is done

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.