Say we want to spin off threads every so often, but we also need the ability to wait until they all go away before exiting the application.
In Haskell, we can do this naive thing:
main = do
count <- newTVarIO 0
let spawnThread action = do