Open neongreen opened 5 years ago
This is similar in spirit to #50.
The GHC docs say that omitting -N
is equivalent to passing -N1
. I don't totally understand why your program wouldn't work when run with a single Haskell capability. Does it fail to print anything at all? I'd expect the main thread to yield to the callback thread in between threadDelay 1000000
calls but maybe some deadlock is happening with foreign function calls.
I'm not sure if there are any checks we can add to the code to prevent this, the same way we did to check for -threaded
on Windows. Like you said, doing non-blocking stuff in the event handler with -N1
is a valid way to use this library. But a note in the docs about threading pitfalls sounds good.
When using
forever $ threadDelay 1000000
, I needed both-threaded
and-with-rtsopts=-N
to get it to work. When usingforever $ getLine
, I only needed-threaded
. Perhaps this should be mentioned in the docs.