创建、初始化/脱离线程
更多...
创建、初始化/脱离线程
源码
#include <rtthread.h>
#define THREAD_PRIORITY 25
#define THREAD_STACK_SIZE 512
#define THREAD_TIMESLICE 5
static void thread1_entry(void *parameter)
{
while (1)
{
}
}
ALIGN(RT_ALIGN_SIZE)
static char thread2_stack[1024];
static void thread2_entry(void *param)
{
for (count = 0; count < 10 ; count++)
{
}
}
int thread_sample(void)
{
THREAD_STACK_SIZE,
THREAD_PRIORITY, THREAD_TIMESLICE);
"thread2",
thread2_entry,
&thread2_stack[0],
sizeof(thread2_stack),
THREAD_PRIORITY - 1, THREAD_TIMESLICE);
return 0;
}