switch to TMVars for thread safety when using the async extension
TVars were not updated atomically, which was ok when each thread got its own External that was the only thing using these TVars. But, with the async extension, several External instances can share the same var, so it needs to be a TMVar to avoid read/write conflicts. In particular, this makes PREPARE only be sent once.
This commit is contained in:
parent
7da2d4dd2d
commit
198b709561
4 changed files with 37 additions and 35 deletions
4
Remote/External/AsyncExtension.hs
vendored
4
Remote/External/AsyncExtension.hs
vendored
|
@ -45,11 +45,9 @@ runRelayToExternalAsync external st = do
|
|||
, externalReceive = atomically (readTBMChan receiveq)
|
||||
-- This shuts down the whole relay.
|
||||
, externalShutdown = shutdown external st sendq
|
||||
-- These three TVars are shared amoung all
|
||||
-- These three TMVars are shared amoung all
|
||||
-- ExternalStates that use this relay; they're
|
||||
-- common state about the external process.
|
||||
-- TODO: ALL code using these in Remote.External
|
||||
-- has to be made async-safe.
|
||||
, externalPrepared = externalPrepared st
|
||||
, externalConfig = externalConfig st
|
||||
, externalConfigChanges = externalConfigChanges st
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue