It's important that you have an idea of how suspending computations actually work. In this chapter, we will analyze how compiler transforms suspending functions into state machines, how the thread switching happens, and how exceptions are propagated. Some things that will be covered in this chapter are listed here:
- Continuation Passing Style (CPS) and how it's related to suspending computations
- Many different internal classes that are used when the coroutines are compiled into bytecode
- The Flow of interception of a coroutine, including how threads are switched
- Exception propagation with and without a CoroutineExceptionHandler
During the early sections of this chapter, we will be transforming a suspending function, imitating the work that the compiler does. Please notice that the code we write will not match the bytecode generated...