switch to TMVars for thread safety when using the async extension
authorJoey Hess <joeyh@joeyh.name>
Fri, 14 Aug 2020 18:40:30 +0000 (14:40 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 14 Aug 2020 18:50:09 +0000 (14:50 -0400)
commit198b709561354acd0a2f442c3f12f90751d1dfbb
treead6b4b164d2892704b7a48b00b9fcb8767ab748c
parent7da2d4dd2d5ccc22f41311dac812c9e310763ef9
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.
Remote/External.hs
Remote/External/AsyncExtension.hs
Remote/External/Types.hs
doc/design/external_special_remote_protocol/async_appendix.mdwn