xiaoxiang781216 edited a comment on pull request #5070:
URL: https://github.com/apache/incubator-nuttx/pull/5070#issuecomment-1000980875


   > Drivers that use the semaphores for signaling should not be involved with 
priority inheritance (when enabled). That use case was assumed to be the non 
default.
   
   Why non default? semaphore use as signaling is a normal practice in POSIX. 
On the other hand, most program use POSIX pthread mutex as lock.
   I have to say that it's very bad choice to enable priority inheritance by 
default when priority inheritance get implemented, because:
   
   1. It's an optional feature, which mean that the code which use sem_t but 
not call nxsem_set_protocol(NuttX specific), the behavior will change 
with/without enable this feature.
   2. Since priority inheritance is the default setting, which mean the wrong 
usage will crash the system. It's more serious than the priority inversion.
   
   > 
   > It seams to me this change can be done with adding an Kconfig option for 
the default and leave it as it was.
   
   Kconfig is good to disable/enable the optional feature, but it isn't a good 
solution here. Do you want sem_t change it's behavior by an option? And all 
place which call sem_init/nxsem_init need check the option and call 
nxsem_set_protocol with the different value.
   
   > But allow the default to be changed if someone is using Linux code 
semantics.
   
   First, it isn't Linux semantics. Second, my demo show that isn't a minor 
issue because the program will crash the system.


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