summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2021-11-30 18:51:18 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-01 03:12:56 -0500
commitf124f2a0ca3ba2b80839d8f107763ffe3b48b6e0 (patch)
tree6f9a9867fd7719f8264eb45431181d6b7bb95f14
parentb53f122749af4dec41e3b4fde4c4c3bfcd459982 (diff)
downloadhaskell-f124f2a0ca3ba2b80839d8f107763ffe3b48b6e0.tar.gz
rts: Annotate benign race in pthread ticker's exit test
Previously TSAN would report spurious data races due to the unsynchronized access of `exited`. I would have thought that using a relaxed load on `exited` would be enough to convince TSAN that the race was intentional, but apparently not. Closes #20690.
-rw-r--r--rts/posix/ticker/Pthread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/rts/posix/ticker/Pthread.c b/rts/posix/ticker/Pthread.c
index f07d000dac..7d39fd1b10 100644
--- a/rts/posix/ticker/Pthread.c
+++ b/rts/posix/ticker/Pthread.c
@@ -109,6 +109,7 @@ static void *itimer_thread_func(void *_handle_tick)
// Relaxed is sufficient: If we don't see that exited was set in one iteration we will
// see it next time.
+ TSAN_ANNOTATE_BENIGN_RACE(&exited, "itimer_thread_func");
while (!RELAXED_LOAD(&exited)) {
if (USE_TIMERFD_FOR_ITIMER) {
ssize_t r = read(timerfd, &nticks, sizeof(nticks));