summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2025-05-13 22:36:09 -0700
committerJohn Hawthorn <[email protected]>2025-05-15 15:18:10 -0700
commitd67d169aeae8b05f8b06f4829de6d5f14059cfea ()
treec0be842a91d79045a639b715130cbedecddf264b /thread.c
parentd845da05e83a2c2929ef8d4fd829804d44f292d3 (diff)
Use atomics for system_working global
Although it almost certainly works in this case, volatile is best not used for multi-threaded code. Using atomics instead avoids warnings from TSan. This also simplifies some logic, as system_working was previously only ever assigned to 1, so --system_working <= 0 should always return true (unless it underflowed).
Notes: Merged: https://.com/ruby/ruby/pull/13333
-rw-r--r--thread.c2
1 files changed, 1 insertions, 1 deletions
@@ -148,7 +148,7 @@ static int hrtime_update_expire(rb_hrtime_t *, const rb_hrtime_t);
NORETURN(static void async_bug_fd(const char *mesg, int errno_arg, int fd));
MAYBE_UNUSED(static int consume_communication_pipe(int fd));
-static volatile int system_working = 1;
static rb_internal_thread_specific_key_t specific_key_count;
/********************************************************************************/