New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sched/semaphore: Remove restriction to use nxsem_trywait from ISR #10199
sched/semaphore: Remove restriction to use nxsem_trywait from ISR #10199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be reasonable
need remove the idle check too, since interrupt may also happen in the idle thread. |
Can we add a check to assert if not interrupt context and idle thread than? |
@xiaoxiang781216 do you any ideas about this failure?
|
no, it's legal to call sem_post from the normal thread context. |
This is not about sem_post, but about trywait. I mean to prohibit trywait from the idle task |
Sorry, it's my typo error. After more think, you can do the assert as your suggestion:
|
This would fix #5142 as well |
Considering that `nxsem_trywait` is non-blocking, although not recommended, it could be called from the interrupt handler.
c6163e9
to
baaac91
Compare
Done! Could you please take a look if it makes sense? |
Summary
It could be called from the interrupt handler because
nxsem_trywait
is non-blocking, although not recommended.Impact
Enable applications to call this interface (with
CONFIG_DEBUG_ASSERTIONS
enabled) without problems. No impact for current implementations.Testing
Internal CI testing + NuttX CI.