With the coroutine scheduler, the code behaves in the following manner:
- The first thing that happens is that the coroutine we're running is paused. The coroutine we want to call is handed on to the scheduler, which places it in its list of coroutines that it needs to run.
- Then, the scheduler checks whether a coroutine is waiting and why: for example, new data coming from across the network, or a coroutine being returned; if it's the latter, it adds the waiting coroutines to the list as well.
- After this, the scheduler picks one of the coroutines that needs to be run and resumes it. This means that if a coroutine has a long-running loop that doesn't contain any await expressions, it will block any other coroutine from ...