diff options
| author | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 10:48:19 -0400 |
|---|---|---|
| committer | Ben Gamari <ben@well-typed.com> | 2020-12-01 12:48:53 -0500 |
| commit | 0ad7e4fe2105214889bdbbca5a1f74158729355d (patch) | |
| tree | d4530ec070f04e86bf532882ba6845749fc81781 | |
| parent | 68e93f4dc8c55737df57d84e814e849beb2e366c (diff) | |
| download | haskell-0ad7e4fe2105214889bdbbca5a1f74158729355d.tar.gz | |
rts: Make write of to_cap->inbox atomic
This is necessary since emptyInbox may read from to_cap->inbox without
taking cap->lock.
| -rw-r--r-- | rts/Capability.h | 1 | ||||
| -rw-r--r-- | rts/Messages.c | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/rts/Capability.h b/rts/Capability.h index 44573e92d7..99737e8aa6 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -485,7 +485,6 @@ INLINE_HEADER bool emptyInbox(Capability *cap) // This may race with writes to putMVars and inbox but this harmless for the // intended uses of this function. TSAN_ANNOTATE_BENIGN_RACE(&cap->putMVars, "emptyInbox(cap->putMVars)"); - TSAN_ANNOTATE_BENIGN_RACE(&cap->inbox, "emptyInbox(cap->inbox)"); return (RELAXED_LOAD(&cap->inbox) == (Message*)END_TSO_QUEUE && RELAXED_LOAD(&cap->putMVars) == NULL); } diff --git a/rts/Messages.c b/rts/Messages.c index cadb80281b..0bdeb05aa0 100644 --- a/rts/Messages.c +++ b/rts/Messages.c @@ -39,7 +39,7 @@ void sendMessage(Capability *from_cap, Capability *to_cap, Message *msg) #endif msg->link = to_cap->inbox; - to_cap->inbox = msg; + RELAXED_STORE(&to_cap->inbox, msg); recordClosureMutated(from_cap,(StgClosure*)msg); |
