1. A method of scheduling blocking tasks, comprising: at a device having one or more processors and memory: executing each of a plurality of task functions in a respective coroutine; detecting a first blocking event for a first task function of the plurality of task functions during execution of the first task function; in response to detecting the first blocking event for the first task function: setting a respective blocking state of the first task function to a pause state; pausing execution of the first task function; and placing the first task function among a group of paused task functions; and after pausing the execution of the first task function in response to detecting the first blocking event for the first task function: identifying a second task function among the group of paused task functions for which a respective blocking state has been updated to a running state; removing the second task function from the group of paused task functions; and resuming execution of the second task function.