2 ms·
> The execution flow you describe is similar to JS' event loop yes, in mechanic, the biggest benefit is you can get it via a control statement so its as easy a
by MrStonedOne 5y ago
> The execution flow you describe is similar to JS' event loop
yes, in mechanic, the biggest benefit is you can get it via a control statement so its as easy as typing a keyword and an additional indentation block, ie, you can do it mid function and the function level vars just get copied over, or you can mark the entire function as non-blocking and the stack detaches at the first sleep, but at the non-blocking function, even if the sleep is 10 calls deep from that function. All without the caller of the non-blocking function needing to do anything (the biggest difference from c#'s async/await).
You can even define this on a base function and all 50 million overrides can be trusted to not block the caller.