mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
sched_resume_async() used to forbit current tasks to wake up themselves since it seems tasks can never be runnable to wake themselves up. However there's a special case in the scheduler where a task that is about to sleep may notice it has a pending event and wake itself up asynchronously. Since all sleeping preparation has already been done and scheduler code is a safe zone, it is safe to undo it all and resume about-to-sleep task in the scheduler. We may want to put a BKPT in the pager's suspend routine if it waits for the sleeping task to resume itself, to see if such a wait is successful. It rarely happens.