Merge pull request #1683 from hichard/master
add config main thread priority
This commit is contained in:
commit
1c7447476a
|
@ -13,6 +13,11 @@ if RT_USING_COMPONENTS_INIT
|
||||||
config RT_MAIN_THREAD_STACK_SIZE
|
config RT_MAIN_THREAD_STACK_SIZE
|
||||||
int "Set main thread stack size"
|
int "Set main thread stack size"
|
||||||
default 2048
|
default 2048
|
||||||
|
config RT_MAIN_THREAD_PRIORITY
|
||||||
|
int "Set main thread priority"
|
||||||
|
default 4 if RT_THREAD_PRIORITY_8
|
||||||
|
default 10 if RT_THREAD_PRIORITY_32
|
||||||
|
default 85 if RT_THREAD_PRIORITY_256
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#ifndef RT_MAIN_THREAD_STACK_SIZE
|
#ifndef RT_MAIN_THREAD_STACK_SIZE
|
||||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RT_MAIN_THREAD_PRIORITY
|
||||||
|
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_COMPONENTS_INIT
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
|
@ -205,14 +208,14 @@ void rt_application_init(void)
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
tid = rt_thread_create("main", main_thread_entry, RT_NULL,
|
tid = rt_thread_create("main", main_thread_entry, RT_NULL,
|
||||||
RT_MAIN_THREAD_STACK_SIZE, RT_THREAD_PRIORITY_MAX / 3, 20);
|
RT_MAIN_THREAD_STACK_SIZE, RT_MAIN_THREAD_PRIORITY, 20);
|
||||||
RT_ASSERT(tid != RT_NULL);
|
RT_ASSERT(tid != RT_NULL);
|
||||||
#else
|
#else
|
||||||
rt_err_t result;
|
rt_err_t result;
|
||||||
|
|
||||||
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_THREAD_PRIORITY_MAX / 3, 20);
|
main_stack, sizeof(main_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 */
|
||||||
|
|
Loading…
Reference in New Issue