summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorqiuyiuestc <[email protected]>2010-04-12 17:37:37 +0000
committerqiuyiuestc <[email protected]>2010-04-12 17:37:37 +0000
commitcbfb87fac1020380eca3b15b32ea738820059007 (patch)
tree23522eed21d5abc36ff4ff9fcbf69806cc13e627 /src/thread.c
parentadcbe9d53fbd9753a2f3037569e3d2db8876d0d8 (diff)
add module feature
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@614 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/thread.c b/src/thread.c
index 875a00aedb..b8859f9a0c 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -32,6 +32,10 @@ extern rt_list_t rt_thread_priority_table[RT_THREAD_PRIORITY_MAX];
extern struct rt_thread* rt_current_thread;
extern rt_uint8_t rt_current_priority;
+#ifdef RT_USING_MODULE
+extern struct rt_module* rt_current_module;
+#endif
+
#ifdef RT_USING_HEAP
extern rt_list_t rt_thread_defunct;
#endif
@@ -78,7 +82,8 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread,
#ifdef RT_USING_MODULE
/* init module parent */
- thread->module_parent = RT_NULL;
+ thread->module_parent =
+ (rt_current_module != RT_NULL) ? rt_current_module : RT_NULL;
#endif
/* init user data */
@@ -228,12 +233,12 @@ rt_err_t rt_thread_startup (rt_thread_t thread)
static void rt_thread_exit()
{
struct rt_thread* thread;
- register rt_base_t temp;
+ register rt_base_t temp;
- /* disable interrupt */
- temp = rt_hw_interrupt_disable();
+ /* disable interrupt */
+ temp = rt_hw_interrupt_disable();
- /* get current thread */
+ /* get current thread */
thread = rt_current_thread;
/* remove from schedule */
@@ -628,21 +633,4 @@ rt_thread_t rt_thread_find(char* name)
return thread;
}
-#ifdef RT_USING_MODULE
-#include <rtm.h>
-/* some buildin kernel symbol */
-RTM_EXPORT(rt_thread_init)
-RTM_EXPORT(rt_thread_detach)
-RTM_EXPORT(rt_thread_create)
-RTM_EXPORT(rt_thread_self)
-RTM_EXPORT(rt_thread_find)
-RTM_EXPORT(rt_thread_startup)
-RTM_EXPORT(rt_thread_delete)
-RTM_EXPORT(rt_thread_yield)
-RTM_EXPORT(rt_thread_delay)
-RTM_EXPORT(rt_thread_control)
-RTM_EXPORT(rt_thread_suspend)
-RTM_EXPORT(rt_thread_resume)
-RTM_EXPORT(rt_thread_timeout)
-#endif
/*@}*/