diff options
| author | 2020-08-26 01:16:40 +0000 | |
|---|---|---|
| committer | 2020-08-26 02:43:15 +0000 | |
| commit | ea7bda25ba99262267acaa179762c83e3e96a232 (patch) | |
| tree | cb369d87aba010d75056786120b3ced3b9a8350a | |
| parent | Merge pull request #4572 from lioncash/xbyak (diff) | |
| download | yuzu-ea7bda25ba99262267acaa179762c83e3e96a232.tar.gz yuzu-ea7bda25ba99262267acaa179762c83e3e96a232.tar.xz yuzu-ea7bda25ba99262267acaa179762c83e3e96a232.zip | |
cpu_interrupt_handler: Make is_interrupted an atomic
Fixes a race condition detected from tsan
Diffstat (limited to '')
| -rw-r--r-- | src/core/arm/cpu_interrupt_handler.cpp | 2 | ||||
| -rw-r--r-- | src/core/arm/cpu_interrupt_handler.h | 3 |
2 files changed, 3 insertions, 2 deletions
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 @@ | |||
| 7 | 7 | ||
| 8 | namespace Core { | 8 | namespace Core { |
| 9 | 9 | ||
| 10 | CPUInterruptHandler::CPUInterruptHandler() : is_interrupted{} { | 10 | CPUInterruptHandler::CPUInterruptHandler() { |
| 11 | interrupt_event = std::make_unique<Common::Event>(); | 11 | interrupt_event = std::make_unique<Common::Event>(); |
| 12 | } | 12 | } |
| 13 | 13 | ||
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 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | ||
| 7 | #include <memory> | 8 | #include <memory> |
| 8 | 9 | ||
| 9 | namespace Common { | 10 | namespace Common { |
| @@ -32,7 +33,7 @@ public: | |||
| 32 | void AwaitInterrupt(); | 33 | void AwaitInterrupt(); |
| 33 | 34 | ||
| 34 | private: | 35 | private: |
| 35 | bool is_interrupted{}; | 36 | std::atomic_bool is_interrupted{false}; |
| 36 | std::unique_ptr<Common::Event> interrupt_event; | 37 | std::unique_ptr<Common::Event> interrupt_event; |
| 37 | }; | 38 | }; |
| 38 | 39 | ||