examples/kernel: fix warnings issued by Clang

Fix some "unused variable" and "used before set" warnings.
This commit is contained in:
Grissiom 2014-04-12 16:33:35 +08:00
parent 0c4ac4bd1a
commit 1b878f256f
4 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@
* 线 (5) * 线 (5)
*/ */
#include <rtthread.h> #include <rtthread.h>
#include <time.h>
#include "tc_comm.h" #include "tc_comm.h"
/* 指向线程控制块的指针 */ /* 指向线程控制块的指针 */

View File

@ -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)
{ {

View File

@ -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);

View File

@ -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)
{ {
/* 获取一个满位 */ /* 获取一个满位 */