Explorar el Código

Merge pull request #11 from yangjie11/yangjie

modify format of the samples
yqiu hace 7 años
padre
commit
485021eabc
Se han modificado 3 ficheros con 5 adiciones y 17 borrados
  1. 0 1
      memp_sample.c
  2. 0 14
      producer_consumer.c
  3. 5 2
      timer_sample.c

+ 0 - 1
memp_sample.c

@@ -79,7 +79,6 @@ int mempool_sample(void)
     if (tid1 != RT_NULL)
         rt_thread_startup(tid1);
 
-
     /* 创建线程2:释放内存池*/
     tid2 = rt_thread_create("thread2", thread2_mp_release, RT_NULL,
                             THREAD_STACK_SIZE,

+ 0 - 14
producer_consumer.c

@@ -113,14 +113,7 @@ int producer_consumer(void)
                                     THREAD_STACK_SIZE,
                                     THREAD_PRIORITY - 1, THREAD_TIMESLICE);
     if (producer_tid != RT_NULL)
-    {
         rt_thread_startup(producer_tid);
-    }
-    else
-    {
-        rt_kprintf("create thread producer failed");
-        return -1;
-    }
 
     /* 创建消费者线程 */
     consumer_tid = rt_thread_create("consumer",
@@ -128,14 +121,7 @@ int producer_consumer(void)
                                     THREAD_STACK_SIZE,
                                     THREAD_PRIORITY + 1, THREAD_TIMESLICE);
     if (consumer_tid != RT_NULL)
-    {
         rt_thread_startup(consumer_tid);
-    }
-    else
-    {
-        rt_kprintf("create thread consumer failed");
-        return -1;
-    }
 
     return 0;
 }

+ 5 - 2
timer_sample.c

@@ -48,7 +48,8 @@ int timer_sample(void)
                              RT_TIMER_FLAG_PERIODIC);
 
     /* 启动定时器1 */
-    if (timer1 != RT_NULL) rt_timer_start(timer1);
+    if (timer1 != RT_NULL) 
+        rt_timer_start(timer1);
 
     /* 创建定时器2 单次定时器 */
     timer2 = rt_timer_create("timer2", timeout2,
@@ -56,7 +57,9 @@ int timer_sample(void)
                              RT_TIMER_FLAG_ONE_SHOT);
 
     /* 启动定时器2 */
-    if (timer2 != RT_NULL) rt_timer_start(timer2);
+    if (timer2 != RT_NULL) 
+        rt_timer_start(timer2);
+        
     return 0;
 }