nuttx/mutex: do not use non-nx interface in kernel except libs#6376
nuttx/mutex: do not use non-nx interface in kernel except libs#6376pkarashchenko wants to merge 1 commit into
Conversation
|
@xiaoxiang781216 could you please take a look. I noticed during my work that mutexes use |
|
One of the possible ways may be to get back original code for the files that I've listed in this PR and switching |
c1774ec to
40943e8
Compare
How about we follow sem_t approach:
|
|
Yes. This can work. Similar approach like |
7df8128 to
5bd3a5a
Compare
Done, but IMO we should merge |
5bd3a5a to
46f670a
Compare
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
46f670a to
0c23450
Compare
|
@xiaoxiang781216 seems that |
|
The issue of naming conflict comes from: |
|
@xiaoxiang781216 ping |
|
|
||
| /* Initializers */ | ||
|
|
||
| #define MUTEX_INITIALIZER {SEM_INITIALIZER(1),MUTEX_NO_HOLDER} |
| /* Initializers */ | ||
|
|
||
| #define MUTEX_INITIALIZER {SEM_INITIALIZER(1),MUTEX_NO_HOLDER} | ||
| #define RMUTEX_INITIALIZER {MUTEX_INITIALIZER,0} |
| struct mutex_s | ||
| { | ||
| sem_t sem; | ||
| pid_t holder; |
There was a problem hiding this comment.
why need save pid in this case?
There was a problem hiding this comment.
In general mutex should have the holder stored and do not allow unlock not from a holder thread. We can even DEBUGASSERT if we try to unlock from not a mutex holder
There was a problem hiding this comment.
Since mutex is used very often in the code base. How about we enable this for debugging only?
There was a problem hiding this comment.
Do you mean check for normal mutex? The recursive need to store a holder
It's hard to fix:( |
|
@pkarashchenko Hi, pkarashchenko, is this PR still being modified? |
|
I will review and most probably close this PR as it is outdated |
|
@pkarashchenko, i have a similar modify, please help to review. #8645 |
Summary
The #6320 redirected nxmutex used in kernel to
sem_API family in case ofCONFIG_BUILD_FLAT. That is not correct. This PR is created just for discussion and just highlight the issue.Impact
Testing