- Thu Aug 27, 2015 4:40 am
#27148
hreintke wrote:GigAHerZ,
I don't understand your question.
When you want immediate execution, you can call the function directly., no use for timers etc.
But there is a Timer class in Sming which you can use on milli and microsecond level (not zero).
Well, basically my question is, is there a event stack/callback stack in the sdk/framework?
Because, when you execute a function and for example it wants to stack 2 another functions to be executed right after itself has been completed, then it could register timer with 0 time for both of the functions it wants to execute. Because time is 0, they will be executed right after the main function has been completed, but in the order they were registered to be executed. In addition, if, before those 2 functions were registered, system itself knew it wanted to do something in the first possible "free" moment, it already has put it's own function also into callback stack. So eventually, it may happen, that execution order is: main function -> system internal function -> my first function -> my second function.
In JavaScript world (and i'm not talking in the context of "popup language"), everything is event based and everything has callbacks. There you usually don't call out functions or actions directly (if it's not necessary) but register them into execution stack. This is how you keep your code not blocking other stuff, while at the same time you have only one thread. (But eventually it feels that everything works simultaneously)