diff options
author | eeight <[email protected]> | 2022-05-20 00:26:58 +0300 |
---|---|---|
committer | eeight <[email protected]> | 2022-05-20 00:26:58 +0300 |
commit | 13950b7049e70b9e0adf3cbe48a527f9e8d25e3c (patch) | |
tree | 65359e6418fb7833b826e97044c58c55485941cb /util/system/shellcommand.h | |
parent | d98cd6128e8838e19ae1a95be34385af299dd62a (diff) |
IGNIETFERRO-1105 Get rid of TAtomic in system/{atexit, event, shellcommand}
ref:c74bffae7e90dee515f5089979fc050d20a34e4e
Diffstat (limited to 'util/system/shellcommand.h')
-rw-r--r-- | util/system/shellcommand.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/util/system/shellcommand.h b/util/system/shellcommand.h index 51b08e04b67..c7637821e49 100644 --- a/util/system/shellcommand.h +++ b/util/system/shellcommand.h @@ -14,7 +14,23 @@ #include "mutex.h" #include <sys/types.h> +#include <atomic> + class TShellCommandOptions { + class TCopyableAtomicBool: public std::atomic<bool> { + public: + using std::atomic<bool>::atomic; + TCopyableAtomicBool(const TCopyableAtomicBool& other) + : std::atomic<bool>(other.load(std::memory_order_acquire)) + { + } + + TCopyableAtomicBool& operator=(const TCopyableAtomicBool& other) { + this->store(other.load(std::memory_order_acquire), std::memory_order_release); + return *this; + } + }; + public: struct TUserOptions { TString Name; @@ -185,7 +201,7 @@ public: * @return self */ inline TShellCommandOptions& SetCloseInput(bool val) { - ShouldCloseInput = val; + ShouldCloseInput.store(val); return *this; } @@ -307,7 +323,7 @@ public: bool QuoteArguments = false; bool DetachSession = false; bool CloseStreams = false; - TAtomic ShouldCloseInput = false; + TCopyableAtomicBool ShouldCloseInput = false; EHandleMode InputMode = HANDLE_STREAM; EHandleMode OutputMode = HANDLE_STREAM; EHandleMode ErrorMode = HANDLE_STREAM; |