diff --git a/examples/kernel/event_simple.c b/examples/kernel/event_simple.c index 927ed928b8..e377e721bb 100644 --- a/examples/kernel/event_simple.c +++ b/examples/kernel/event_simple.c @@ -7,6 +7,7 @@ * 一个线程定时发送事件 (事件5) */ #include +#include #include "tc_comm.h" /* 指向线程控制块的指针 */ diff --git a/examples/kernel/mutex_simple.c b/examples/kernel/mutex_simple.c index b84cef12bf..afbab3a3e1 100644 --- a/examples/kernel/mutex_simple.c +++ b/examples/kernel/mutex_simple.c @@ -60,6 +60,10 @@ static void thread3_entry(void* parameter) while (1) { result = rt_mutex_take(mutex, RT_WAITING_FOREVER); + if (result != RT_EOK) + { + tc_stat(TC_STAT_END | TC_STAT_FAILED); + } result = rt_mutex_take(mutex, RT_WAITING_FOREVER); if (result != RT_EOK) { diff --git a/examples/kernel/semaphore_buffer_worker.c b/examples/kernel/semaphore_buffer_worker.c index de46475769..db3285c74b 100644 --- a/examples/kernel/semaphore_buffer_worker.c +++ b/examples/kernel/semaphore_buffer_worker.c @@ -178,8 +178,14 @@ static void worker_entry(void* parameter) /* 持有信号量 */ rt_sem_take(sem, RT_WAITING_FOREVER); + /* 把数据放到环形buffer中 */ result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM); + if (result == RT_FALSE) + { + rt_kprintf("put error\n"); + } + /* 释放信号量 */ rt_sem_release(sem); diff --git a/examples/kernel/semaphore_producer_consumer.c b/examples/kernel/semaphore_producer_consumer.c index 48da714306..a240cfa8b2 100644 --- a/examples/kernel/semaphore_producer_consumer.c +++ b/examples/kernel/semaphore_producer_consumer.c @@ -59,6 +59,7 @@ void consumer_thread_entry(void* parameter) /* 第n个线程,由入口参数传进来 */ no = (rt_uint32_t)parameter; + sum = 0; while(1) { /* 获取一个满位 */