From ea7bda25ba99262267acaa179762c83e3e96a232 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 26 Aug 2020 01:16:40 +0000 Subject: cpu_interrupt_handler: Make is_interrupted an atomic Fixes a race condition detected from tsan --- src/core/arm/cpu_interrupt_handler.cpp | 2 +- src/core/arm/cpu_interrupt_handler.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/arm/cpu_interrupt_handler.cpp b/src/core/arm/cpu_interrupt_handler.cpp index df0350881..4c717ebe9 100644 --- a/src/core/arm/cpu_interrupt_handler.cpp +++ b/src/core/arm/cpu_interrupt_handler.cpp @@ -7,7 +7,7 @@ namespace Core { -CPUInterruptHandler::CPUInterruptHandler() : is_interrupted{} { +CPUInterruptHandler::CPUInterruptHandler() { interrupt_event = std::make_unique(); } diff --git a/src/core/arm/cpu_interrupt_handler.h b/src/core/arm/cpu_interrupt_handler.h index 3d062d326..61c22fef9 100644 --- a/src/core/arm/cpu_interrupt_handler.h +++ b/src/core/arm/cpu_interrupt_handler.h @@ -4,6 +4,7 @@ #pragma once +#include #include namespace Common { @@ -32,7 +33,7 @@ public: void AwaitInterrupt(); private: - bool is_interrupted{}; + std::atomic_bool is_interrupted{false}; std::unique_ptr interrupt_event; }; -- cgit v1.2.3