@@ -119,10 +119,7 @@ forkFinally1 action and_then =
119119forkIt :: (MonadBaseControl IO m, MonadIO m) => EventF -> (EventF -> m t) -> m ()
120120forkIt current proc = do
121121 child <- newChildCont current
122− tid <- forkFinally1 (runInChild proc child)
123− $ \res -> do
124− thId <- myThreadId
125− beforeExit child{threadId = thId} res
122+ tid <- forkFinally1 (proc child) (beforeExit child)
126123 updatePendingThreads current tid
127124
128125 where
@@ -144,11 +141,6 @@ forkIt current proc = do
144141 , zombieChannel = chan
145142 }
146143
147− runInChild m child = do
148− th <- liftIO $ myThreadId
149− dbg $ "Forked: child " ++ show th
150− m child{threadId = th}
151−
152144 beforeExit cur res = do
153145 case res of
154146 Left _exc -> liftIO $ killChildren cur
@@ -161,7 +153,8 @@ forkIt current proc = do
161153 -- We are guaranteed to have a parent because we have been explicitly
162154 -- forked by some parent.
163155 let p = fromJust (parent cur)
164− liftIO $ atomically $ writeTChan (zombieChannel p) (threadId cur)
156+ tid <- myThreadId
157+ liftIO $ atomically $ writeTChan (zombieChannel p) tid
165158
166159forkMaybe :: (MonadBaseControl IO m, MonadIO m) => EventF -> (EventF -> m ()) -> m ()
167160forkMaybe current toRun = do
@@ -179,9 +172,7 @@ forkMaybe current toRun = do
179172 waitForOneChild (zombieChannel current)
180173 (pendingThreads current)
181174 forkMaybe current toRun
182− True -> do
183− dbg $ "Forking: parent " ++ show (threadId current)
184− forkIt current toRun
175+ True -> forkIt current toRun
185176
186177-- | 'StreamData' represents a task in a task stream being generated.
187178data StreamData a =