As a C++ developer specializing in multithreading, I've been diving into the intricacies of async/await. It's been a challenge for me as these concepts differ from how C++ programs are typically executed.
I grasp the concept of Promise objects, understand that concurrency is not the same as parallelism, and have some knowledge about the event loop. I comprehend the idea of a single-threaded application executing different parts concurrently, but what triggers an event on the event loop? Is it initiated by the Promise object or the async keyword? Or does it stem from certain I/O functions to prevent blocking?
The closest comparison I can draw is with the Global Interpreter Lock in Python, where multiple threads wait for a global lock, leading to a round-robin execution method. However, this doesn't involve an event loop like in languages such as JavaScript or TypeScript, which function with just a single thread.
If anyone could offer guidance (or suggest valuable resources) to help me better understand the flow of execution in async/await, I would greatly appreciate it. Thank you!