summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-06-12 10:01:48 +0000
committer[email protected] <[email protected]>2011-06-12 10:01:48 +0000
commit864bd1180237c952beefda21266c3f76f288b99a (patch)
tree0d437761b4efee23c50b0a6e88e6a664fd55b2cf /src/thread.c
parent8c3d1e5eaec88d77a2fe623e9d478b9542bad040 (diff)
Add reentrance check. Put kernel debug switch together.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1494 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/thread.c b/src/thread.c
index 61a5d9d023..3411ff1d3d 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -26,7 +26,6 @@
#include <rthw.h>
#include "kservice.h"
-/*#define THREAD_DEBUG */
extern rt_list_t rt_thread_priority_table[RT_THREAD_PRIORITY_MAX];
extern struct rt_thread* rt_current_thread;
@@ -206,10 +205,8 @@ rt_err_t rt_thread_startup (rt_thread_t thread)
thread->number_mask = 1L << thread->current_priority; //1L means long int,fixed compile mistake with IAR EW M16C v3.401,fify 20100410
#endif
-#ifdef THREAD_DEBUG
- rt_kprintf("startup a thread:%s with priority:%d\n", thread->name, thread->init_priority);
-#endif
-
+ RT_DEBUG_LOG(RT_DEBUG_THREAD,\
+ ("startup a thread:%s with priority:%d\n", thread->name, thread->init_priority));
/* change thread stat */
thread->stat = RT_THREAD_SUSPEND;
/* then resume it */
@@ -536,15 +533,13 @@ rt_err_t rt_thread_suspend (rt_thread_t thread)
/* thread check */
RT_ASSERT(thread != RT_NULL);
-#ifdef THREAD_DEBUG
- rt_kprintf("thread suspend: %s\n", thread->name);
-#endif
+ RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: %s\n", thread->name));
if (thread->stat != RT_THREAD_READY)
{
-#ifdef THREAD_DEBUG
- rt_kprintf("thread suspend: thread disorder, %d\n", thread->stat);
-#endif
+ RT_DEBUG_LOG(RT_DEBUG_THREAD,\
+ ("thread suspend: thread disorder, %d\n", thread->stat));
+
return -RT_ERROR;
}
@@ -576,15 +571,13 @@ rt_err_t rt_thread_resume (rt_thread_t thread)
/* thread check */
RT_ASSERT(thread != RT_NULL);
-#ifdef THREAD_DEBUG
- rt_kprintf("thread resume: %s\n", thread->name);
-#endif
+ RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: %s\n", thread->name));
if (thread->stat != RT_THREAD_SUSPEND)
{
-#ifdef THREAD_DEBUG
- rt_kprintf("thread resume: thread disorder, %d\n", thread->stat);
-#endif
+ RT_DEBUG_LOG(RT_DEBUG_THREAD, \
+ ("thread resume: thread disorder, %d\n", thread->stat));
+
return -RT_ERROR;
}