Przeglądaj źródła

RT_IPC_FLAG_FIFO->RT_IPC_FLAG_PRIO

Meco Man 4 lat temu
rodzic
commit
9bd397a8d6

+ 1 - 1
en/event_sample.c

@@ -94,7 +94,7 @@ int event_sample(void)
     rt_err_t result;
 
     /* initiate the event (statically) */
-    result = rt_event_init(&event, "event", RT_IPC_FLAG_FIFO);
+    result = rt_event_init(&event, "event", RT_IPC_FLAG_PRIO);
     if (result != RT_EOK)
     {
         rt_kprintf("init event failed.\n");

+ 1 - 1
en/mailbox_sample.c

@@ -106,7 +106,7 @@ int mailbox_sample(void)
                         "mbt",
                         &mb_pool[0],
                         sizeof(mb_pool) / sizeof(rt_ubase_t), /* size of mails */
-                        RT_IPC_FLAG_FIFO);
+                        RT_IPC_FLAG_PRIO);
     if (result != RT_EOK)
     {
         rt_kprintf("init mailbox failed.\n");

+ 1 - 1
en/msgq_sample.c

@@ -120,7 +120,7 @@ int msgq_sample(void)
                         &msg_pool[0],               /* msg_pool's address */
                         1,                          /* the size of each message is 1 byte */
                         sizeof(msg_pool),           /* The size of the memory pool is the size of msg_pool */
-                        RT_IPC_FLAG_FIFO);
+                        RT_IPC_FLAG_PRIO);
 
     if (result != RT_EOK)
     {

+ 3 - 3
en/producer_consumer.c

@@ -102,9 +102,9 @@ int producer_consumer(void)
     set = 0;
     get = 0;
 
-    rt_sem_init(&sem_lock, "lock",     1,      RT_IPC_FLAG_FIFO);
-    rt_sem_init(&sem_empty, "empty",   MAXSEM, RT_IPC_FLAG_FIFO);
-    rt_sem_init(&sem_full, "full",     0,      RT_IPC_FLAG_FIFO);
+    rt_sem_init(&sem_lock, "lock",     1,      RT_IPC_FLAG_PRIO);
+    rt_sem_init(&sem_empty, "empty",   MAXSEM, RT_IPC_FLAG_PRIO);
+    rt_sem_init(&sem_full, "full",     0,      RT_IPC_FLAG_PRIO);
 
     producer_tid = rt_thread_create("producer",
                                     producer_thread_entry, RT_NULL,

+ 1 - 1
en/semaphore_sample.c

@@ -80,7 +80,7 @@ static void rt_thread2_entry(void *parameter)
 int semaphore_sample()
 {
     /* create semaphtore and its initial value is 0 */
-    dynamic_sem = rt_sem_create("dsem", 0, RT_IPC_FLAG_FIFO);
+    dynamic_sem = rt_sem_create("dsem", 0, RT_IPC_FLAG_PRIO);
     if (dynamic_sem == RT_NULL)
     {
         rt_kprintf("create dynamic semaphore failed.\n");

+ 1 - 1
zh/event_sample.c

@@ -81,7 +81,7 @@ int event_sample(void)
     rt_err_t result;
 
     /* 初始化事件对象 */
-    result = rt_event_init(&event, "event", RT_IPC_FLAG_FIFO);
+    result = rt_event_init(&event, "event", RT_IPC_FLAG_PRIO);
     if (result != RT_EOK)
     {
         rt_kprintf("init event failed.\n");

+ 1 - 1
zh/mailbox_sample.c

@@ -97,7 +97,7 @@ int mailbox_sample(void)
                         "mbt",                      /* 名称是mbt */
                         &mb_pool[0],                /* 邮箱用到的内存池是mb_pool */
                         sizeof(mb_pool) / sizeof(rt_ubase_t), /* 邮箱中的邮件数目,sizeof(rt_ubase_t)表示指针大小 */
-                        RT_IPC_FLAG_FIFO);          /* 采用FIFO方式进行线程等待 */
+                        RT_IPC_FLAG_PRIO);          /* 采用PRIO方式进行线程等待 */
     if (result != RT_EOK)
     {
         rt_kprintf("init mailbox failed.\n");

+ 1 - 1
zh/mailbox_urgent_sample.c

@@ -97,7 +97,7 @@ int mailbox_urgent_sample(void)
                         "mbt",                      /* 名称是mbt */
                         &mb_pool[0],                /* 邮箱用到的内存池是mb_pool */
                         sizeof(mb_pool) / sizeof(rt_ubase_t), /* 邮箱中的邮件数目,sizeof(rt_ubase_t)表示指针大小 */
-                        RT_IPC_FLAG_FIFO);          /* 采用FIFO方式进行线程等待 */
+                        RT_IPC_FLAG_PRIO);          /* 采用PRIO方式进行线程等待 */
     if (result != RT_EOK)
     {
         rt_kprintf("init mailbox failed.\n");

+ 1 - 1
zh/msgq_sample.c

@@ -113,7 +113,7 @@ int msgq_sample(void)
                         &msg_pool[0],               /* 内存池指向msg_pool */
                         1,                          /* 每个消息的大小是 1 字节 */
                         sizeof(msg_pool),           /* 内存池的大小是msg_pool的大小 */
-                        RT_IPC_FLAG_FIFO);          /* 如果有多个线程等待,按照先来先得到的方法分配消息 */
+                        RT_IPC_FLAG_PRIO);          /* 如果有多个线程等待,按照先来先得到的方法分配消息 */
 
     if (result != RT_EOK)
     {

+ 3 - 3
zh/producer_consumer.c

@@ -103,9 +103,9 @@ int producer_consumer(void)
     get = 0;
 
     /* 初始化3个信号量 */
-    rt_sem_init(&sem_lock, "lock",     1,      RT_IPC_FLAG_FIFO);
-    rt_sem_init(&sem_empty, "empty",   MAXSEM, RT_IPC_FLAG_FIFO);
-    rt_sem_init(&sem_full, "full",     0,      RT_IPC_FLAG_FIFO);
+    rt_sem_init(&sem_lock, "lock",     1,      RT_IPC_FLAG_PRIO);
+    rt_sem_init(&sem_empty, "empty",   MAXSEM, RT_IPC_FLAG_PRIO);
+    rt_sem_init(&sem_full, "full",     0,      RT_IPC_FLAG_PRIO);
 
     /* 创建生产者线程 */
     producer_tid = rt_thread_create("producer",

+ 1 - 1
zh/semaphore_sample.c

@@ -76,7 +76,7 @@ static void rt_thread2_entry(void *parameter)
 int semaphore_sample()
 {
     /* 创建一个动态信号量,初始值是0 */
-    dynamic_sem = rt_sem_create("dsem", 0, RT_IPC_FLAG_FIFO);
+    dynamic_sem = rt_sem_create("dsem", 0, RT_IPC_FLAG_PRIO);
     if (dynamic_sem == RT_NULL)
     {
         rt_kprintf("create dynamic semaphore failed.\n");