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:
parent
0a70235b0c
commit
39449c6069
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
****************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue