[Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

Bulat Ziganshin bulatz at HotPOP.com
Mon Dec 12 05:50:22 EST 2005


Hello Branimir,

Sunday, December 11, 2005, 9:43:08 PM, you wrote:

BM> After seeing this only I can tell that for example in C++ one can't cout
BM> clog cerr
BM> or post some event via synchronized event queue or condition variable
BM> from signal handler.
BM> All of that would result in ghosts and goblins in program.

it is not the case for Haskell. at least, the following handler works
very well in GHC 6.4/windows:

handleCtrlBreak handler action = do
  myThread <- myThreadId
  let onBreak event = do
        putStr " ^Break!"
        programTerminated =: True
        handler
        killThread myThread
  bracket (installHandler$ Catch onBreak) (installHandler) $  \oldHandler -> do
    action

>>This way I know what the signal was that triggered the handler and I  can
>>tell that it was triggered. The deadlock is somewhere else  because the 
>>handler is not being tripped.

but in 6.4.1 (ATTENTION, JOEL!) this code was breaked. i does an
investigation and found that in 6.4.1 with -threaded ^Break hadnling
works only in main program thread! i complained several days ago in
ghc-bugs list. you, Joel, can get example i posted there, replace
windows-specific ^Break handling with Unix one and test it

-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list