immortal

Spawn threads that never die (unless told to do so)

https://github.com/feuerbach/immortal

Version on this page:0.2.2
LTS Haskell 22.14:0.3
Stackage Nightly 2024-03-28:0.3
Latest on Hackage:0.3

See all snapshots immortal appears in

MIT licensed by Roman Cheplyaka
Maintained by [email protected]
This version can be pinned in stack with:immortal-0.2.2@sha256:08b27e158dfe1b9aa1f3c80c107fd1ea4091d7e02c4dff5b1d24a5fefae17013,1208

Module documentation for 0.2.2

immortal

A small library to create threads that never die. This is useful e.g. for writing servers.

import qualified System.Immortal as Immortal
import Control.Concurrent (threadDelay)
import Control.Monad (forever)

main = do
  -- start an immortal thread
  _thread <- Immortal.create $ \ _thread -> do
    -- do stuff

  -- in the main thread, sleep until interrupted
  -- (e.g. with Ctrl-C)
  forever $ threadDelay maxBound

Changes

CHANGES

Version 0.2.2

Add onUnexpectedFinish

Version 0.2.1

Add wait and wait-stm functions

Version 0.2

  • Pass a Thread handle to the thread itself
  • Add mortalize, immortalize