You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Figure out if a thread is alive in io-classes #227
Is your feature request related to a problem? Please describe.
With the removal of threadStatus support there is no way to figure out, to my best understanding, if a thread is alive or not.
Describe the solution you'd like
Since threadStatus has some issues in GHC, could we perhaps add something like isAlive :: ThreadId -> Bool which should have much clearer semantics?
Describe alternatives you've considered
Not being able to know if a part of your system is alive?
Additional context
This is usually possible in multi-threaded systems you'd like to model with io-sim...
On a more serious note, this should be relatively straight-forward to implement without bumping into any of the really nasty bugs in GHC that caused this to be problematic before. For IO we should be able to do:
isAlive::ThreadId->IOBool
isAlive tid = (`notElem` [ThreadFinished, ThreadDied]) <$> threadStatus tid
The tricky part is to implement it in a way that IOSimPOR can discover races, e.g. if one thread is scheduled before the monitoring one, the monitoring one can receive a different result and thus land in a different execution branch.
Activity
MaximilianAlgehed commentedon Oct 15, 2025
On a more serious note, this should be relatively straight-forward to implement without bumping into any of the really nasty bugs in GHC that caused this to be problematic before. For
IOwe should be able to do:coot commentedon Oct 28, 2025
The tricky part is to implement it in a way that
IOSimPORcan discover races, e.g. if one thread is scheduled before the monitoring one, the monitoring one can receive a different result and thus land in a different execution branch.