riscv_common: make thread_yield_higher IRQ compatible

This commit is contained in:
Koen Zandberg 2021-02-08 11:04:18 +01:00
parent 50cf93c719
commit 0b2810a856
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -21,6 +21,8 @@
#ifndef THREAD_ARCH_H
#define THREAD_ARCH_H
#include "irq.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -44,7 +46,12 @@ static inline void _ecall_dispatch(uint32_t num, void *ctx)
static inline __attribute__((always_inline)) void thread_yield_higher(void)
{
_ecall_dispatch(0, NULL);
if (irq_is_in()) {
sched_context_switch_request = 1;
}
else {
_ecall_dispatch(0, NULL);
}
}
#endif /* DOXYGEN */