ostest:add sem protocl to priority inheritance#1358
Conversation
| sem_init(&g_sem, 0, NLOWPRI_THREADS); | ||
| sem_setprotocol(&g_sem, SEM_PRIO_INHERIT); |
There was a problem hiding this comment.
why not change to nxmutex?
There was a problem hiding this comment.
ostest is app,nxmutex is kernal,so we need add mutex for app?
There was a problem hiding this comment.
since this is used to test the api usage, it's better to call the core api directly instead of wrapper.
|
@anjiahao1 @xiaoxiang781216 |
ostest testcase use sem as lock need set protocl Signed-off-by: anjiahao <anjiahao@xiaomi.com>
if sem used as lock,need set protocl to priority inheritance, others do not need |
|
@masayuki2009 @pkarashchenko do you have more concern about this change? |
This is a case of counting semaphore with priority inheritance enabled. We discussed this apache/nuttx#6965 (comment) . So the question that I raise long time in the past comes again: Should priority inheritance be an option of semaphore or mutex only. In this case I'll rephrase it: Should we allow enabling of priority inheritance for non-binary semaphores. If yes, then we probably need to update many places in code with similar changes. |
Yes, but ostest is very special one, because it verify the internal detail of OS implementation, and understanding the real behavior change between the enable and disable of priority inheritance.
I don't believe that the non-binary semaphore can work well with the priority inheritance in general. The priority inheritance is meaningful only when:
|
|
Yeah, currently with |
|
Let me merge this PR since apache/nuttx#5070 has been merged. |
Summary
ostest,sem use lock need set protocl
SEM_PRIO_INHERITpatch
impact
use sem as lock,need do is change
Testing
ostest