diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-27 00:34:58 +0100 |
---|---|---|
committer | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-27 00:34:58 +0100 |
commit | 9629feffd76ec19e215ba556304b5514229156dc (patch) | |
tree | 693910ce104c6555093d665ce96b64d5886a8b67 | |
parent | 87e24569fd04b8959db760c576af0d78bdc21580 (diff) |
feat(System.Ticked): make runTicked cancel-able
-rw-r--r-- | lib/System/Ticked.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/System/Ticked.hs b/lib/System/Ticked.hs index ae4cfd8..8fb93ea 100644 --- a/lib/System/Ticked.hs +++ b/lib/System/Ticked.hs @@ -36,12 +36,13 @@ runTicked delay action = do tickQueue <- Ticked <$> newTBQueueIO 1 tr <- async $ tickRunner tickQueue action - link tr + linkOnly (const True) tr tg <- async $ tickGenerator delay tickQueue 0 - link tg + linkOnly (const True) tg - link2 tg tr + link2Only (const True) tg tr wait tg wait tr +-- we use linkOnly (const True) to also stop if one of the threads gets cancelled |