tmedicci commented on code in PR #8985:
URL: https://github.com/apache/nuttx/pull/8985#discussion_r1164037374


##########
drivers/pipes/pipe_common.c:
##########
@@ -105,6 +105,8 @@ FAR struct pipe_dev_s *pipecommon_allocdev(size_t bufsize)
       nxmutex_init(&dev->d_bflock);
       nxsem_init(&dev->d_rdsem, 0, 0);
       nxsem_init(&dev->d_wrsem, 0, 0);
+      nxsem_init(&dev->d_nrdsem, 0, 0);
+      nxsem_init(&dev->d_nwrsem, 0, 0);

Review Comment:
   `d_wrsem` (and `d_rdsem`) could both be reused (in fact, `d_rdsem` was being 
reused prior this PR). However, these semaphores had well-defined meanings:
   ```
     sem_t      d_rdsem;       /* Empty buffer - Reader waits for data write */
     sem_t      d_wrsem;       /* Full buffer - Writer waits for data read */
   ```
   
   I preferred not to reuse them following the _explicit is better than 
implicit_. Let me know if you prefer to save some bytes instead and I'll change 
it ;)



-- 
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