1. A computer processor and memory running a real-time operating system (RTOS) for the computer processor performing a first plurality of tasks including a first task and a second task, the RTOS comprising: a subsystem providing a plurality of task priorities such that not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only a single stack; a plurality of task queues including a pending queue, a running queue and a blocked queue; a task scheduler that uses the plurality of task queues including the pending queue, the running queue and the blocked queue, and that, when invoked, switches control to a highest-priority one from the pending queue of the first plurality of tasks; a continuations library subsystem that automatically manages a plurality of continuation points including a first continuation point; a yield function that sets the first continuation point in the first task and yields control to the task scheduler, whereupon the task scheduler switches control to the second task and wherein at a later time the task scheduler switches control back to the first task at the first continuation point; and a nested blocking function call subsystem, that invokes a second blocking function in the second task from within a first blocking function in the second task and yields control to the task scheduler, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked.