aboutsummaryrefslogtreecommitdiff
path: root/Remote/External
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-09-30 19:51:16 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-09-30 19:51:16 -0400
commitd684c2f53135f51872c112732acc4079b2d4693d (patch)
treed7a6895a1b2874d436fb094625174859c325bac8 /Remote/External
parent0a588575977bc74a61917801477e03da3897507d (diff)
convert TMVars that are never left empty into TVars
This is probably more efficient, and it avoids mistakenly leaving them empty.
Diffstat (limited to 'Remote/External')
-rw-r--r--Remote/External/Types.hs18
1 files changed, 8 insertions, 10 deletions
diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs
index 33a22aeb1..2306989bb 100644
--- a/Remote/External/Types.hs
+++ b/Remote/External/Types.hs
@@ -45,10 +45,10 @@ import Network.URI
data External = External
{ externalType :: ExternalType
, externalUUID :: UUID
- , externalState :: TMVar [ExternalState]
- -- ^ TMVar is never left empty; list contains states for external
- -- special remote processes that are not currently in use.
- , externalLastPid :: TMVar PID
+ , externalState :: TVar [ExternalState]
+ -- ^ Contains states for external special remote processes
+ -- that are not currently in use.
+ , externalLastPid :: TVar PID
, externalDefaultConfig :: RemoteConfig
, externalGitConfig :: RemoteGitConfig
}
@@ -57,8 +57,8 @@ newExternal :: ExternalType -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex
newExternal externaltype u c gc = liftIO $ External
<$> pure externaltype
<*> pure u
- <*> atomically (newTMVar [])
- <*> atomically (newTMVar 0)
+ <*> atomically (newTVar [])
+ <*> atomically (newTVar 0)
<*> pure c
<*> pure gc
@@ -69,10 +69,8 @@ data ExternalState = ExternalState
, externalReceive :: Handle
, externalShutdown :: IO ()
, externalPid :: PID
- , externalPrepared :: TMVar PrepareStatus
- -- ^ Never left empty.
- , externalConfig :: TMVar RemoteConfig
- -- ^ Never left empty.
+ , externalPrepared :: TVar PrepareStatus
+ , externalConfig :: TVar RemoteConfig
}
type PID = Int