3 ms·
Maybe not async as I think the await keyword is probably enough on its own. As for why it exists... Await/explicit yielding enables cooperative multitasking w
by jayd16 5y ago
Maybe not async as I think the await keyword is probably enough on its own. As for why it exists...
Await/explicit yielding enables cooperative multitasking where the programmer has exclusive control of some execution context, be it a thread or fiber or whatever, until they decide to yield.
Without that you only have implicit scheduling and execution could be yielded at unpredictable times. The programmer then needs to add other things like semaphores to specify the critical sections and you run the risk of deadlocks.
There might be a new language that comes along but right now await exists for a reason.