You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import qualified Control.Concurrent.Async as Async
import qualified Control.Exception as Exception
import qualified UnliftIO.Async as UnliftIO
main :: IO ()
main = UnliftIO.mapConcurrently_ (forever . print) ("01234" <> undefined :: [Char]) `Exception.finally` putStrLn "Finished"
The expectation is that the threads spawned by mapConcurrently_ are terminated before "Finished" is printed, but this is the output:
$ ./utest
Finished!
'3'
'4'
'0'
'1'
'2'
utest: Prelude.undefined
CallStack (from HasCallStack):
undefined, called at utest/Main.hs:9:64 in main:Main
'3'
'4'
Replacing "UnliftIO.mapConcurrently_" with "Async.mapConcurrently_", I get the expected output:
$ ./result/bin/log-performance-test
'1'
'0'
Finished!
utest: Prelude.undefined
CallStack (from HasCallStack):
undefined, called at utest/Main.hs:9:61 in main:Main
The mapConcurrently (without _) function has similar differences. The test was run on Ubuntu Linux 23.10 with GHC 9.4.8, async 2.2.4, and unliftio 0.2.25.0.
The text was updated successfully, but these errors were encountered:
Consider this simple test:
The expectation is that the threads spawned by mapConcurrently_ are terminated before "Finished" is printed, but this is the output:
Replacing "UnliftIO.mapConcurrently_" with "Async.mapConcurrently_", I get the expected output:
The mapConcurrently (without _) function has similar differences. The test was run on Ubuntu Linux 23.10 with GHC 9.4.8, async 2.2.4, and unliftio 0.2.25.0.
The text was updated successfully, but these errors were encountered: