Hmm. Using your experiment, I didn't see any differing behavior from my original example (both GHC 7.6.3 and 7.8.3). What should I have expected?

That being said, I hadn't tried sending SIGINT to the running process as you suggested. Thanks for this idea. Both for my example and yours, it takes two SIGINTs to kill the process. Interesting and surely not desired behavior, but I might not understand what the implications are.

I ran each program with strace and sent SIGINTs to it while running. I found it interesting that each program had paused emitting SIGVTALRMs until I sent the first SIGINT, which then it resumed without interrupting the sleep. The second SIGINT exited the process.

I'm even more curious &/ confused about the interaction of unbounded threads and signals now, or if there's any interaction at all. The pausing of the SIGVTALTRMs mentioned above makes me wonder whether it's the unbounded thread or some auxiliary mechanism that helps prevent interrupts.

I'd love to have a deeper understanding of this interworking between signals and unbounded threads. My own web scouring hasn't turned up anything, but I'd be happy to be pointed somewhere.

Kindly,
Lane

On Thu, Sep 25, 2014 at 3:59 PM, Albert Y. C. Lai <trebla@vex.net> wrote:
On 14-09-25 03:55 PM, Lane Seppala wrote:
As the simplest example, compiled with the threaded runtime (and
neglecting imports):

     main = void $ sleep 10

will be interrupted, whereas

     main = void $ runInUnboundThread $ sleep 10

will complete its 10 second sleep.

Before you commit to your understanding, consider one more experiment that changes everything:

main = void $ runInUnboundThread (runInBoundThread $ sleep 10)

Also, consider hitting CTRL-C (or sending SIGINT any way), see what does not happen. Do you want this behaviour?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe