From 554c772f9562f95a28c0986f7b9d34cdfa28e8c9 Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Tue, 26 Feb 2013 23:29:13 +0000 Subject: [PATCH] ARM: Allow threads to run to completion. --- platforms/qemu_integratorcp/main.c | 10 +++------- ports/arm/atomport.c | 8 +++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/platforms/qemu_integratorcp/main.c b/platforms/qemu_integratorcp/main.c index 7ec93e8..8f0a05a 100644 --- a/platforms/qemu_integratorcp/main.c +++ b/platforms/qemu_integratorcp/main.c @@ -53,15 +53,11 @@ void test_thread (uint32_t param) { uint32_t failures ; - CRITICAL_STORE ; failures = test_start () ; - - atomTimerDelay (10) ; - CRITICAL_START() ; - printf ("%s %s\r\n", ATOMTHREADS_TEST, failures ? "FAIL" : "PASS") ; - exit (failures) ; - CRITICAL_END() ; + printf ("%s %s\r\n", ATOMTHREADS_TEST, failures ? "FAIL" : "PASS") ; + + return; } /** diff --git a/ports/arm/atomport.c b/ports/arm/atomport.c index d6fc47b..ea3691a 100644 --- a/ports/arm/atomport.c +++ b/ports/arm/atomport.c @@ -61,8 +61,7 @@ thread_shell (void) * Enable interrupts - these will not be enabled when a thread * is first restored. */ - // sei(); - contextEnableInterrupts () ; + contextEnableInterrupts () ; /* Call the thread entry point */ if (curr_tcb && curr_tcb->entry_point) @@ -70,7 +69,10 @@ thread_shell (void) curr_tcb->entry_point(curr_tcb->entry_param); } - /* Not reached - threads should never return from the entry point */ + /* Thread has run to completion: remove it from the ready list */ + curr_tcb->suspended = TRUE; + atomSched (FALSE); + }