按照例程,在main函数中创建了两个线程
/*******************************************************************************
local func
tions
*******************************************************************************/
#define THREAD_PRIORITY 25
#define THREAD_STACK_SIZE 1024
#define THREAD_TIMESLICE 5
static rt_thread_t tid1 = RT_NULL;
static void thread1_entry(void *parameter)
{
rt_uint32_t count = 0;
while (1)
{
rt_kprintf("thread1 count: %d
", count ++);
rt_thread_mdelay(500);
}
}
ALIGN(RT_ALIGN_SIZE)
static char thread2_stack[1024];
static struct rt_thread thread2;
static void thread2_entry(void *param)
{
rt_uint32_t count = 0;
for (count = 0; count < 10 ; count++)
{
rt_kprintf("thread2 count: %d
", count);
}
rt_kprintf("thread2 exit
");
}
int thread_sample(void)
{
tid1 = rt_thread_create("thread1",
thread1_entry, RT_NULL,
THREAD_STACK_SIZE,
THREAD_PRIORITY, THREAD_TIMESLICE);
if (tid1 != RT_NULL) {
rt_kprintf("FUNC[%s], LINE[%d]
", __FUNCTION__, __LINE__);
rt_thread_startup(tid1);
}
rt_thread_init(&thread2,
"thread2",
thread2_entry,
RT_NULL,
&thread2_stack[0],
sizeof(thread2_stack),
THREAD_PRIORITY - 1, THREAD_TIMESLICE);
rt_thread_startup(&thread2);
return 0;
}
/*******************************************************************************
public functions
*******************************************************************************/
int main(void)
{
uint32_t ret = E_ERROR;
uint32_t loop_flag = 1;
rt_kprintf("Created time: %s[%s]
", __DATE__, __TIME__);
thread_sample();
//while(1);
while(1) {
rt_thread_mdelay(1000);
rt_kprintf("hello
");
}
if(loop_flag) {
while(1) {
reg32_write(TUBE_BASE_ADDR, 0x23);
}
}
/* never reach here */
return 0;
}
但是创建的两个线程好像没有运行