Loading...
Searching...
No Matches
thread_arch.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Koen Zandberg <koen@bergzand.net>
3 * SPDX-FileCopyrightText: 2021 Inria
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
18
19#include "cpu_conf.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define THREAD_API_INLINED
26
27#ifndef DOXYGEN /* Doxygen is in core/include/thread.h */
28
29static inline __attribute__((always_inline)) void thread_yield_higher(void)
30{
31 /* trigger the PENDSV interrupt to run scheduler and schedule new thread if
32 * applicable */
33 SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
34 /* flush the pipeline. Otherwise we risk that subsequent instructions are
35 * executed before the IRQ has actually triggered */
36 __ISB();
37}
38
39#endif /* DOXYGEN */
40
41#ifdef __cplusplus
42}
43#endif
44
THREAD_MAYBE_INLINE void thread_yield_higher(void)
Lets current thread yield in favor of a higher prioritized thread.