on master help sign in
Add a comment to relinkForks
commitb8fb0bd908a7facf6be8da549366891b1f460208 authorAndrzej Rybczak <andrzej@rybczak.net> dateThu 24 Jun 2021, 16:39 (5 years ago) parent7a1d6f9
1 file changed+3
src/Effectful/Internal/Env.hs+3
src/Effectful/Internal/Env.hs+3
@@ -239,6 +239,9 @@ relinkForks :: UniqueGen -> EnvRefCache -> Forks -> IO Forks
239239relinkForks ug cache = \case
240240 NoFork -> pure NoFork
241241 Forks fid lref0 forks -> do
242+ -- A specific IORef EnvRef can be held by more than one local environment
243+ -- and we need to replace all its occurences with the same, new value
244+ -- containing its clone.
242245 readIORef cache >>= pure . M.lookup fid >>= \case
243246 Just lref -> Forks fid <$> pure lref
244247 <*> relinkForks ug cache forks