From 54453a0748bbf6b6c5764f6becb81f8557b9e87f Mon Sep 17 00:00:00 2001 From: mbbill Date: Tue, 29 Dec 2009 08:13:45 +0000 Subject: [PATCH] FIX: Revert thread.c and rtthread.h to previous version. FIX: Abort handler will suspend current thread instead of terminate it. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@260 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- include/rtthread.h | 3 +-- libcpu/arm/AT91SAM7X/trap.c | 12 +++++++----- src/thread.c | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/rtthread.h b/include/rtthread.h index ae619f4a31..e2654496b0 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -112,7 +112,6 @@ rt_err_t rt_thread_control(rt_thread_t thread, rt_uint8_t cmd, void* arg); rt_err_t rt_thread_suspend(rt_thread_t thread); rt_err_t rt_thread_resume(rt_thread_t thread); void rt_thread_timeout(void* parameter); -void rt_thread_exit(void); /* * idle thread interface @@ -176,7 +175,7 @@ void rt_free (void *ptr); void* rt_realloc(void *ptr, rt_size_t nbytes); void *rt_calloc(rt_size_t count, rt_size_t size); -void rt_memory_info(rt_uint32_t *total, +void rt_memory_info(rt_uint32_t *total, rt_uint32_t *used, rt_uint32_t *max_used); diff --git a/libcpu/arm/AT91SAM7X/trap.c b/libcpu/arm/AT91SAM7X/trap.c index 513871a462..8bc0559d23 100644 --- a/libcpu/arm/AT91SAM7X/trap.c +++ b/libcpu/arm/AT91SAM7X/trap.c @@ -36,11 +36,13 @@ void rt_hw_trap_fiq() { rt_kprintf("fast interrupt request\n"); } - -extern void rt_thread_exit(void); + +extern struct rt_thread* rt_current_thread; void rt_hw_trap_abort() -{ - rt_thread_exit(); - rt_kprintf("Abort occured, thread terminated.\n"); +{ + rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name); + rt_thread_suspend(rt_current_thread); + rt_schedule(); + } /*@}*/ diff --git a/src/thread.c b/src/thread.c index e678b06946..a9bfd91144 100644 --- a/src/thread.c +++ b/src/thread.c @@ -34,6 +34,7 @@ extern rt_uint8_t rt_current_priority; extern rt_list_t rt_thread_defunct; #endif +static void rt_thread_exit(void); void rt_thread_timeout(void* parameter); static rt_err_t _rt_thread_init(struct rt_thread* thread, @@ -222,7 +223,7 @@ rt_err_t rt_thread_startup (rt_thread_t thread) return RT_EOK; } -void rt_thread_exit() +static void rt_thread_exit() { struct rt_thread* thread; register rt_base_t temp;