examples/kernel: fix warnings issued by Clang
Fix some "unused variable" and "used before set" warnings.
This commit is contained in:
parent
0c4ac4bd1a
commit
1b878f256f
|
@ -7,6 +7,7 @@
|
||||||
* 一个线程定时发送事件 (事件5)
|
* 一个线程定时发送事件 (事件5)
|
||||||
*/
|
*/
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
#include <time.h>
|
||||||
#include "tc_comm.h"
|
#include "tc_comm.h"
|
||||||
|
|
||||||
/* 指向线程控制块的指针 */
|
/* 指向线程控制块的指针 */
|
||||||
|
|
|
@ -60,6 +60,10 @@ static void thread3_entry(void* parameter)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
|
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);
|
result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
|
||||||
if (result != RT_EOK)
|
if (result != RT_EOK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,8 +178,14 @@ static void worker_entry(void* parameter)
|
||||||
|
|
||||||
/* 持有信号量 */
|
/* 持有信号量 */
|
||||||
rt_sem_take(sem, RT_WAITING_FOREVER);
|
rt_sem_take(sem, RT_WAITING_FOREVER);
|
||||||
|
|
||||||
/* 把数据放到环形buffer中 */
|
/* 把数据放到环形buffer中 */
|
||||||
result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM);
|
result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM);
|
||||||
|
if (result == RT_FALSE)
|
||||||
|
{
|
||||||
|
rt_kprintf("put error\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* 释放信号量 */
|
/* 释放信号量 */
|
||||||
rt_sem_release(sem);
|
rt_sem_release(sem);
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ void consumer_thread_entry(void* parameter)
|
||||||
/* 第n个线程,由入口参数传进来 */
|
/* 第n个线程,由入口参数传进来 */
|
||||||
no = (rt_uint32_t)parameter;
|
no = (rt_uint32_t)parameter;
|
||||||
|
|
||||||
|
sum = 0;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
/* 获取一个满位 */
|
/* 获取一个满位 */
|
||||||
|
|
Loading…
Reference in New Issue