Closed qrilka closed 6 years ago
I've found threadStatus
but it still looks inconvenient to add extra code to check (periodically) that thread is alive
Given the simplicity of that code, I would expect it to never die. That said, nothing guarantees that. Perhaps what you're looking for is to have the guarantee that it won't die, rather than doing monitoring of it yourself?
Yes, some guarantee, I guess I could do that by adding setUncaughtExceptionHandler
.
And regarding thread exit when GC isn't enabled I see that you can't do that inside of MonadState
but probably it's worth to warn about it in haddocks?
And regarding thread exit when GC isn't enabled I see that you can't do that inside of MonadState but probably it's worth to warn about it in haddocks?
I don't quite understand this comment.
Can you check master
now and see if the latest commit does what you want?
thanks, it great
ghcStats
returns IO action to fork a thread but gives (almost) no way to control its lifetime. If I understand it correctly the only way to find out ifThreadId
is alive is to callthreadCapability
which looks a bit odd. Also that thread exits with a message in STDOUT if GC stats are not enabled. Wouldn't it be better for this function to have a typem (Maybe (IO ()))
soNothing
would mean that GC stats are not enableds and returnIO ()
could be e.g. linked to the main thread usinglink
fromasync
package. Or maybe I miss something here and there is easier way to control ghc metrics thread lifetime?