thread_arch.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2008-2009 Heiko Will <hwill@inf.fu-berlin.de>
3  * SPDX-FileCopyrightText: 2009 Kaspar Schleiser <kaspar@schleiser.de>
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
20 #include "irq.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define THREAD_API_INLINED
27 
28 #ifndef DOXYGEN /* Doxygen is in core/include/thread.h */
29 
30 static inline __attribute__((always_inline)) void thread_yield_higher(void)
31 {
32  if (irq_is_in()) {
34  }
35  else {
36  __asm__("svc 0\n");
37  }
38 }
39 
40 #endif /* DOXYGEN */
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
MAYBE_INLINE bool irq_is_in(void)
Check whether called from interrupt service routine.
volatile unsigned int sched_context_switch_request
Flag indicating whether a context switch is necessary after handling an interrupt.
THREAD_MAYBE_INLINE void thread_yield_higher(void)
Lets current thread yield in favor of a higher prioritized thread.
IRQ driver interface.