mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 08:32:45 +08:00
Mark s_cancellation_signal a relaxed atomic
Thread sanitizer is salty about this even though it's volatile sig_atomic_t. Make it atomic too.
This commit is contained in:
parent
3f3531c819
commit
457f95fe52
|
@ -93,9 +93,10 @@ class relaxed_atomic_t {
|
|||
relaxed_atomic_t() = default;
|
||||
relaxed_atomic_t(T value) : value_(value) {}
|
||||
|
||||
operator T() const { return value_.load(std::memory_order_relaxed); }
|
||||
operator T() const volatile { return value_.load(std::memory_order_relaxed); }
|
||||
|
||||
void operator=(T v) { return value_.store(v, std::memory_order_relaxed); }
|
||||
void operator=(T v) volatile { return value_.store(v, std::memory_order_relaxed); }
|
||||
|
||||
// Perform a CAS operation, returning whether it succeeded.
|
||||
bool compare_exchange(T expected, T desired) {
|
||||
|
|
|
@ -201,7 +201,7 @@ static bool reraise_if_forked_child(int sig) {
|
|||
|
||||
/// The cancellation signal we have received.
|
||||
/// Of course this is modified from a signal handler.
|
||||
static volatile sig_atomic_t s_cancellation_signal = 0;
|
||||
static volatile relaxed_atomic_t<sig_atomic_t> s_cancellation_signal{0};
|
||||
|
||||
void signal_clear_cancel() { s_cancellation_signal = 0; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user