| From 4cbb225811205b51b65371d0d8abc2d2af8233b6 Mon Sep 17 00:00:00 2001 |
| From: Khem Raj <raj.khem@gmail.com> |
| Date: Thu, 26 Jan 2023 14:56:36 -0800 |
| Subject: [PATCH] Use std::atomic<int> instead of std::atomic<bool> |
| |
| GCC on RISCV does not yet support inline subword atomics [1] |
| Therefore avoid them until fixed |
| |
| Upstream-Status: Pending |
| |
| [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338 |
| |
| Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| --- |
| Foundation/include/Poco/AsyncChannel.h | 2 +- |
| Foundation/src/AsyncChannel.cpp | 5 ++--- |
| 2 files changed, 3 insertions(+), 4 deletions(-) |
| |
| diff --git a/Foundation/include/Poco/AsyncChannel.h b/Foundation/include/Poco/AsyncChannel.h |
| index 190bae7dd..d73ea6c72 100644 |
| --- a/Foundation/include/Poco/AsyncChannel.h |
| +++ b/Foundation/include/Poco/AsyncChannel.h |
| @@ -111,7 +111,7 @@ private: |
| NotificationQueue _queue; |
| std::size_t _queueSize = 0; |
| std::size_t _dropCount = 0; |
| - std::atomic<bool> _closed; |
| + std::atomic<int> _closed; |
| }; |
| |
| |
| diff --git a/Foundation/src/AsyncChannel.cpp b/Foundation/src/AsyncChannel.cpp |
| index 37cdec477..e829b180c 100644 |
| --- a/Foundation/src/AsyncChannel.cpp |
| +++ b/Foundation/src/AsyncChannel.cpp |
| @@ -48,11 +48,10 @@ private: |
| Message _msg; |
| }; |
| |
| - |
| AsyncChannel::AsyncChannel(Channel::Ptr pChannel, Thread::Priority prio): |
| _pChannel(pChannel), |
| _thread("AsyncChannel"), |
| - _closed(false) |
| + _closed(0) |
| { |
| _thread.setPriority(prio); |
| } |
| @@ -95,7 +94,7 @@ void AsyncChannel::open() |
| |
| void AsyncChannel::close() |
| { |
| - if (!_closed.exchange(true)) |
| + if (!_closed.exchange(1)) |
| { |
| if (_thread.isRunning()) |
| { |
| -- |
| 2.39.1 |
| |