I'm writing a Haskell binding to some the library and there is a function void foo()
, which calls select()
inside. When i call this function from Haskell, that select()
call starts to constantly return EINTR
. This confuses library code and it starts looping forever.
In the #haskell
IRC channel i've been told to run foo()
from a bound thread. I've used runInBoundThread
for this and now everything seems to work. But in some rare cases i'm getting Alarm clock
message in the console (Ok, i've found it means that app catches SIGALRM).
I'm not sure it's proper way to handle this problem and i don't want to depend on Control.Concurrency
. What should i do?
The cause of SIGALRM was GHC's runtime using old codepath for managing timer stuff. This old codepath was turning on because GHC's configure script had sort of linuxism in its check for create_timer()
function. Fixing it made GHC use the same mechanism that is used on all platforms, and eliminated the error in question.
Relevant Phabricator Diff: https://phabricator.haskell.org/D831
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With