I am currently serving in the National Guard of Ukraine and am not able to perform my maintainer duties.
Please see https://ro-che.info/articles/2014-02-08-my-haskell-will.
Spawn threads that never die (unless told to do so)
License: MIT License
I am currently serving in the National Guard of Ukraine and am not able to perform my maintainer duties.
Please see https://ro-che.info/articles/2014-02-08-my-haskell-will.
For graceful shutdown, I wait for threads to finish in my servers main loop. I would like to do the same with Immortal threads.
I changed the definition to
data Thread = Thread ThreadId (IORef Bool) (TMVar ())
and added the function
wait :: Thread -> IO ()
wait (Thread _ _ finished) = atomically $ takeTMVar finished >> putTMVar finished ()
Should I put together a pull request?
Hi, would you accept a patch that replaces the dependency on monad-control
with unliftio-core
? (MonadBaseControl m
-> MonadUnliftIO m
).
The docs for immortal
read:
The monadic «state» (captured by the
MonadBaseControl
instance) will be preserved if the computation terminates normally, and reset when the exception is thrown, so be cautious whenm
is stateful. It is completely safe, however, to instantiate m with something likeReaderT conf IO
to pass configuration to the new thread.
which is the problem MonadUnliftIO
is meant to solve.
What do you think about adding support for bound threads?
I tried simply changing forkIO
to forkOS
and it seems to work fine on my machine (although the -threaded
GHC option is now needed).
(Use case: call C functions that require bound threads.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.