From e14b2f0d2406311a6fcdaea313584995ec8adefd Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 20 Jul 2013 08:41:41 +0200 Subject: Add support for sleeping threads. --- interrupt/fault.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'interrupt') diff --git a/interrupt/fault.cpp b/interrupt/fault.cpp index 9af0eb8..8a577bf 100644 --- a/interrupt/fault.cpp +++ b/interrupt/fault.cpp @@ -13,9 +13,11 @@ inline void __attribute__((naked)) switch_context() { // Update running thread. if(!Thread::reschedule()) { - // TODO: Set SLEEPONEXIT + // No threads are ready - set SLEEPONEXIT. + SCB.SCR = 1 << 1; } else { - // TODO: Clear SLEEPONEXIT + // Clear SLEEPONEXIT. + SCB.SCR = 0 << 1; } // Fetch stack pointer for new thread. -- cgit v1.2.3