masayuki2009 commented on code in PR #8383:
URL: https://github.com/apache/nuttx/pull/8383#discussion_r1092547460


##########
fs/mqueue/mq_open.c:
##########
@@ -211,10 +214,15 @@ static int file_mq_vopen(FAR struct file *mq, FAR const 
char *mq_name,
   /* Make sure that the check for the existence of the message queue
    * and the creation of the message queue are atomic with respect to
    * other processes executing mq_open().  A simple sched_lock() should
-   * be sufficient.
+   * be sufficient for non-SMP case but critical section is needed for
+   * SMP case.
    */
 
+#ifdef CONFIG_SMP
+  flags = enter_critical_section();
+#else

Review Comment:
   @xiaoxiang781216 
   
   To reduce code maintenance costs, always using enter_critical_setion() would 
be better. However, using enter_critical_section() for non-SMP cases would 
increase interrupt latency since it disables interrupts. So sched_lock() would 
be better for non-SMP cases. What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to