xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274841464

   > > @masayuki2009 it's hard to split the style change from the patch now. 
could you have method to retrieve the old revision from github?
   > 
   > I think you can always retrieve the old revision from the latest master.
   > 
   
   I mean the intermediate change in this PR, not the latest master. This patch 
contain 20000~ change, 10000~ change is about sem_t/mutex_t. It's very hard(or 
impossible) to separate sem_t/mutext_t change from the style one.
   
   > Actually, there are many changes that do not relate to 'nxmutex replace 
nexsem' For example, besides the style changes, I can also see the changes such 
as (`kmm_malloc` to `kmm_zalloc`,
   
   This is part of nxmutex_t change since @pkarashchenko suggest we initialize 
all global mutex_t field through NXMUTEX_INITIALIZER, which mean we need ensure 
no place zero out the global variables again, otherwise the static 
initialization will be lost. How to ensure this doesn't happen? The safest 
approach I can come up is to reduce memset as much as possible, so I can check 
the rest memset more quickly and less error. That's why I change 
kmm_malloc+memset to kmm_zalloc.
   
   > `i2c_givesem` to `nxsem_post`, etc).
   
   It's also part of sem_t and nxmutex_t replacement to avoid people consider 
the code use sem_t as lock(i2c_givesem/i2c_takesem) and remove the 
unneeded/simple one line wrapper. After the change, the rule is simple:
   
   1. sem_t is always used as signal or resource couting(call 
nxsem_wait/nxsem_post, never takesem/givesem)
   2. mutex_t is always used as lock(call nxmutex_lock/nxmutex_unlock)
   


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