diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-12-01 11:55:46 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 21:02:11 -0400 |
commit | f97c59ce014687979fa731db7227773fa83d2156 (patch) | |
tree | c6ef7fd5d08d6a48ed23b256cab1a9fef890c901 /libraries | |
parent | bf1b0bc78da7dbe5f6fbda54b37a9cb165ff857f (diff) | |
download | haskell-f97c59ce014687979fa731db7227773fa83d2156.tar.gz |
Mitigate data races in event manager startup/shutdownwip/tsan/event-mgr
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Event/Control.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/GHC/Event/Control.hs b/libraries/base/GHC/Event/Control.hs index a9f23e07d2..9054da4f22 100644 --- a/libraries/base/GHC/Event/Control.hs +++ b/libraries/base/GHC/Event/Control.hs @@ -123,6 +123,10 @@ newControl shouldRegister = allocaArray 2 $ \fds -> do -- the RTS, then *BEFORE* the wakeup file is closed, we must call -- c_setIOManagerWakeupFd (-1), so that the RTS does not try to use the wakeup -- file after it has been closed. +-- +-- Note, however, that even if we do the above, this function is still racy +-- since we do not synchronize between here and ioManagerWakeup. +-- ioManagerWakeup ignores failures that arise from this case. closeControl :: Control -> IO () closeControl w = do _ <- atomicSwapIORef (controlIsDead w) True |