Просмотр исходного кода

更新rt_mq_recv在不同版本上的返回值,更新en版本的链接

yangjie11 2 лет назад
Родитель
Сommit
4e58398105

+ 1 - 1
en/dynmem_sample.c

@@ -16,7 +16,7 @@
  * Each time it allocates more memory, and it will end when it can't allocate any memory.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/memory/memory/#memory-management
+ *    https://www.rt-thread.io/document/site/programming-manual/memory/memory/
  */
 
 #include <rtthread.h>

+ 1 - 1
en/event_sample.c

@@ -17,7 +17,7 @@
  *    2) thread #2: sent events (Event3 and Event5)
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#event
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#event
  */
 
 #include <rtthread.h>

+ 2 - 2
en/idlehook_sample.c

@@ -16,8 +16,8 @@
  * thread hook function will be invoked when thread #1 is delaying.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread/thread/#set-and-delete-idle-hooks
- *    https://www.rt-thread.io/document/site/thread/thread/#idle-thread
+ *    https://www.rt-thread.io/document/site/programming-manual/thread/thread/#set-and-delete-idle-hooks
+ *    https://www.rt-thread.io/document/site/programming-manual/thread/thread/#idle-thread
  */
 
 #include <rtthread.h>

+ 1 - 1
en/interrupt_sample.c

@@ -15,7 +15,7 @@
  * This demo demonstrates how to disable and enable interrupt to access global variable.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/interrupt/interrupt/
+ *    https://www.rt-thread.io/document/site/programming-manual/interrupt/interrupt/
  */
 
 #include <rthw.h>

+ 1 - 1
en/mailbox_sample.c

@@ -17,7 +17,7 @@
  *    2) thread #2: send mails
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-comm/thread-comm/#mailbox
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc2/ipc2/#mailbox
  */
 
 #include <rtthread.h>

+ 1 - 1
en/memp_sample.c

@@ -17,7 +17,7 @@
  *   2) thread #2: free memory pool
  *
  * read more:
- *    https://www.rt-thread.io/document/site/memory/memory/#memory-pool
+ *    https://www.rt-thread.io/document/site/programming-manual/memory/memory/#memory-pool
  */
 
 #include <rtthread.h>

+ 5 - 1
en/msgq_sample.c

@@ -17,7 +17,7 @@
  *    2) thread #2: send normal and urgent messages to message queue
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-comm/thread-comm/#message-queue
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc2/ipc2/#message-queue
  */
 
 #include <rtthread.h>
@@ -47,7 +47,11 @@ static void thread1_entry(void *parameter)
     while (1)
     {
         /* pend and receive message(s) from message queue */
+#if (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 1))
+        if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) > 0)
+#else
         if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) == RT_EOK)
+#endif
         {
             rt_kprintf("thread1: recv msg from msg queue, the content:%c\n", buf);
             if (cnt == 19)

+ 1 - 1
en/mutex_sample.c

@@ -15,7 +15,7 @@
  * This demo demonstrates how the mutex manage the shared resource.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#mutex
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#mutex
  */
 
 #include <rtthread.h>

+ 1 - 1
en/priority_inversion.c

@@ -16,7 +16,7 @@
  * demonstrate how the mutex prevents priority inversions.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#mutex
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#mutex
  */
 
 #include <rtthread.h>

+ 1 - 1
en/producer_consumer.c

@@ -17,7 +17,7 @@
  *     2) consumer thread: prints out the value and adds it up
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#semaphores
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#semaphores
  */
 
 #include <rtthread.h>

+ 1 - 1
en/scheduler_hook.c

@@ -15,7 +15,7 @@
  * This demo sets a scheduler hook function and prints context-switching information.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread/thread/#set-the-scheduler-hook
+ *    https://www.rt-thread.io/document/site/programming-manual/thread/thread/#set-the-scheduler-hook
  */
 
 #include <rtthread.h>

+ 1 - 1
en/semaphore_sample.c

@@ -16,7 +16,7 @@
  *    2) thread #2: receive the semaphore
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#semaphores
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#semaphores
  */
 
 #include <rtthread.h>

+ 1 - 1
en/signal_sample.c

@@ -19,7 +19,7 @@
  * This thread will receive the signal and print the message.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread-comm/thread-comm/#signal
+ *    https://www.rt-thread.io/document/site/programming-manual/ipc2/ipc2/#signal
  */
 
 #include <rtthread.h>

+ 1 - 1
en/thread_sample.c

@@ -17,7 +17,7 @@
  *    2) create thread #2 statically, and print counting numbers continuously.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread/thread/
+ *    https://www.rt-thread.io/document/site/programming-manual/thread/thread/
  */
 
 #include <rtthread.h>

+ 1 - 1
en/timer_sample.c

@@ -17,7 +17,7 @@
  *    2) timer #2: periodic mode timer
  *
  * read more:
- *    https://www.rt-thread.io/document/site/timer/timer/#timer-management
+ *    https://www.rt-thread.io/document/site/programming-manual/timer/timer/#timer-management
  */
 
 #include <rtthread.h>

+ 1 - 1
en/timeslice_sample.c

@@ -15,7 +15,7 @@
  * This demo creates two threads to show how Time-Slicing works.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread/thread/#time-slice
+ *    https://www.rt-thread.io/document/site/programming-manual/thread/thread/#time-slice
  */
 
 #include <rtthread.h>

+ 4 - 0
zh/msgq_sample.c

@@ -41,7 +41,11 @@ static void thread1_entry(void *parameter)
     while (1)
     {
         /* 从消息队列中接收消息 */
+#if (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 1))
+        if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) > 0)
+#else
         if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) == RT_EOK)
+#endif
         {
             rt_kprintf("thread1: recv msg from msg queue, the content:%c\n", buf);
             if (cnt == 19)