提交 43ede185 编写于 作者: mysterywolf's avatar mysterywolf 提交者: guo

[kernel] 优化内置线程命名

main线程栈指定对齐字节数
上级 d49ac097
...@@ -166,8 +166,8 @@ int entry(void) ...@@ -166,8 +166,8 @@ int entry(void)
#ifndef RT_USING_HEAP #ifndef RT_USING_HEAP
/* if there is not enable heap, we should use static thread and stack. */ /* if there is not enable heap, we should use static thread and stack. */
ALIGN(8) ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE]; static rt_uint8_t main_thread_stack[RT_MAIN_THREAD_STACK_SIZE];
struct rt_thread main_thread; struct rt_thread main_thread;
#endif /* RT_USING_HEAP */ #endif /* RT_USING_HEAP */
...@@ -216,7 +216,7 @@ void rt_application_init(void) ...@@ -216,7 +216,7 @@ void rt_application_init(void)
tid = &main_thread; tid = &main_thread;
result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL, result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL,
main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20); main_thread_stack, sizeof(main_thread_stack), RT_MAIN_THREAD_PRIORITY, 20);
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
/* if not define RT_USING_HEAP, using to eliminate the warning */ /* if not define RT_USING_HEAP, using to eliminate the warning */
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
static rt_list_t _rt_thread_defunct = RT_LIST_OBJECT_INIT(_rt_thread_defunct); static rt_list_t _rt_thread_defunct = RT_LIST_OBJECT_INIT(_rt_thread_defunct);
static struct rt_thread idle[_CPUS_NR]; static struct rt_thread idle_thread[_CPUS_NR];
ALIGN(RT_ALIGN_SIZE) ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t rt_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE]; static rt_uint8_t idle_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE];
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
#ifndef SYSTEM_THREAD_STACK_SIZE #ifndef SYSTEM_THREAD_STACK_SIZE
...@@ -248,7 +248,7 @@ static void rt_defunct_execute(void) ...@@ -248,7 +248,7 @@ static void rt_defunct_execute(void)
} }
} }
static void rt_thread_idle_entry(void *parameter) static void idle_thread_entry(void *parameter)
{ {
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
if (rt_hw_cpu_id() != 0) if (rt_hw_cpu_id() != 0)
...@@ -306,24 +306,24 @@ static void rt_thread_system_entry(void *parameter) ...@@ -306,24 +306,24 @@ static void rt_thread_system_entry(void *parameter)
void rt_thread_idle_init(void) void rt_thread_idle_init(void)
{ {
rt_ubase_t i; rt_ubase_t i;
char tidle_name[RT_NAME_MAX]; char idle_thread_name[RT_NAME_MAX];
for (i = 0; i < _CPUS_NR; i++) for (i = 0; i < _CPUS_NR; i++)
{ {
rt_sprintf(tidle_name, "tidle%d", i); rt_sprintf(idle_thread_name, "tidle%d", i);
rt_thread_init(&idle[i], rt_thread_init(&idle_thread[i],
tidle_name, idle_thread_name,
rt_thread_idle_entry, idle_thread_entry,
RT_NULL, RT_NULL,
&rt_thread_stack[i][0], &idle_thread_stack[i][0],
sizeof(rt_thread_stack[i]), sizeof(idle_thread_stack[i]),
RT_THREAD_PRIORITY_MAX - 1, RT_THREAD_PRIORITY_MAX - 1,
32); 32);
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i); rt_thread_control(&idle_thread[i], RT_THREAD_CTRL_BIND_CPU, (void*)i);
#endif /* RT_USING_SMP */ #endif /* RT_USING_SMP */
/* startup */ /* startup */
rt_thread_startup(&idle[i]); rt_thread_startup(&idle_thread[i]);
} }
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
...@@ -356,5 +356,5 @@ rt_thread_t rt_thread_idle_gethandler(void) ...@@ -356,5 +356,5 @@ rt_thread_t rt_thread_idle_gethandler(void)
int id = 0; int id = 0;
#endif /* RT_USING_SMP */ #endif /* RT_USING_SMP */
return (rt_thread_t)(&idle[id]); return (rt_thread_t)(&idle_thread[id]);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册