You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/07 12:35:37 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

xiaoxiang781216 commented on a change in pull request #5429:
URL: https://github.com/apache/incubator-nuttx/pull/5429#discussion_r800611436



##########
File path: drivers/serial/pty.c
##########
@@ -278,67 +278,51 @@ static int pty_open(FAR struct file *filep)
   DEBUGASSERT(dev != NULL && dev->pd_devpair != NULL);
   devpair = dev->pd_devpair;
 
+  /* Get exclusive access to the device structure */
+
+  ret = pty_semtake(devpair);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   /* Wait if this is an attempt to open the slave device and the slave
    * device is locked.
    */
 
   if (!dev->pd_master)
     {
-      /* Slave... Check if the slave driver is locked.  We need to lock the
-       * scheduler while we are running to prevent asyncrhonous modification
-       * of pp_locked by pty_ioctl().
-       */
+      /* Slave... Check if the slave driver is locked. */
 
-      sched_lock();
       while (devpair->pp_locked)
         {
+          /* Release the exclusive acces before wait */

Review comment:
       Done.




-- 
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-unsubscribe@nuttx.apache.org

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