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

[ concurrency, library, mit ] [ Propose Tags ]

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


[Skip to Readme]
Versions 0.1, 0.2, 0.2.2, 0.2.2.1, 0.3
Change log CHANGELOG.md
Dependencies base (>=4.5 && <5), stm, unliftio-core (>=0.1.1.0) [details]
License MIT
Author Roman Cheplyaka
Maintainer roma@ro-che.info
Category Concurrency
Home page https://github.com/feuerbach/immortal
Source repo head: git clone https://github.com/feuerbach/immortal.git
Uploaded by RomanCheplyaka at Mon Apr 16 08:18:15 UTC 2018
Distributions LTSHaskell:0.2.2.1, NixOS:0.3, Stackage:0.3, openSUSE:0.2.2.1
Downloads 1504 total (35 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-04-16 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for immortal-0.3

[back to package description]

immortal

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

import qualified Control.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