@@ -9,7 +9,7 @@ module Strands.Threads
12− , waitAsync
12+ , gather
@@ -538,13 +538,14 @@ finishComputation x = AsyncT $ do
538 collectResult x
538 collectResult x
539 return Nothing
539 return Nothing
541−-- XXX pass a collector function and return a Traversable.
541+-- XXX pass a collector function and return a Traversable?
542−-- XXX Ideally it should be a non-empty list instead.
542+-- XXX Ideally it should be a non-empty list.
543−-- | Run an 'AsyncT m' computation. Returns a list of results of the
544+-- | Run an 'AsyncT m' computation and collect the results generated by each
544−-- computation or may throw an exception.
545+-- thread of the computation in a list.
545−waitAsync :: forall m a. (MonadIO m, MonadCatch m)
546+gather :: forall m a. (MonadIO m, MonadCatch m)
546 => AsyncT m a -> m [a]
547 => AsyncT m a -> m [a]
547−waitAsync m = do
548+gather m = do
548 childChan <- liftIO $ atomically newTChan
549 childChan <- liftIO $ atomically newTChan
549 pendingRef <- liftIO $ newIORef []
550 pendingRef <- liftIO $ newIORef []
550 resultsRef <- liftIO $ newIORef []
551 resultsRef <- liftIO $ newIORef []