1
0
Fork 0
forked from nuttx/nuttx-update

sched/sched.h: add nxsched_lock/unlock_irq() function

These two macros can be called in interrupt context and:
1. Do nothing when called in interrupt;
2. Same behavior as sched_lock/unlock when called in thread;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2024-05-24 14:30:07 +08:00 committed by Xiang Xiao
parent 0a70235b0c
commit 39449c6069

View file

@ -242,6 +242,13 @@
# define this_cpu() (0)
#endif
/* Task Switching Interfaces (non-standard).
* These two macros can be called in interrupt context.
*/
#define nxsched_lock_irq() (up_interrupt_context() ? OK : sched_lock())
#define nxsched_unlock_irq() (up_interrupt_context() ? OK : sched_unlock())
/****************************************************************************
* Public Type Definitions
****************************************************************************/