Thursday, April 28, 2011

How is setTimeout implemented in the javascript interpreters or timers in general?

How is a function called after a time has passed implemented in javascript or any other interpreted language?

In other words, is there a loop behind in the javascript interpreter that checks all the time a list of timers, or is there any particular way that the operating systems handle this?

Thanks

From stackoverflow
  • You could look at the source of Firefox or WebKit to see how they implemented it.

    alvatar : Yes. But actually I want to know if there is a general approach that could be used in any language.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.