thread_arch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008, 2009 Heiko Will <hwill@inf.fu-berlin.de>
3  * Copyright (C) 2009 Kaspar Schleiser <kaspar@schleiser.de>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
20 #ifndef THREAD_ARCH_H
21 #define THREAD_ARCH_H
22 
23 #include "irq.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define THREAD_API_INLINED
30 
31 #ifndef DOXYGEN /* Doxygen is in core/include/thread.h */
32 
33 static inline __attribute__((always_inline)) void thread_yield_higher(void)
34 {
35  if (irq_is_in()) {
37  }
38  else {
39  __asm__("svc 0\n");
40  }
41 }
42 
43 #endif /* DOXYGEN */
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* THREAD_ARCH_H */
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.