1. A method comprising: defining a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution; spawning a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks; running a control thread to determine if a task of the first plurality of tasks and the second plurality of tasks is associated with coroutine execution or with task-specific thread execution; if the task is determined to be associated with coroutine execution, running the control thread to swap a coroutine context of the control thread with a coroutine context of the task; and if the task is determined to be associated with thread execution, running the control thread to resume a thread associated with the task and to suspend the control thread.