Changes between Version 4 and Version 5 of Commentary/Rts/Signals


Ignore:
Timestamp:
Mar 4, 2010 7:06:35 PM (4 years ago)
Author:
dons
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/Signals

    v4 v5  
    6363When using foreign libraries through the Haskell FFI, it is important 
    6464to ensure that the foreign code is capable of dealing with system call 
    65 interrupts due to alarm signals.  For example, in this `strace` output 
     65interrupts due to alarm signals. Most C libraries we deal with don't install signal handlers, so this is a not an issue. However, if the C library *does* install a signal handler, you'll  
     66need to be careful how it interprets the time signal from GHC. 
     67 
     68For example, in this `strace` output 
    6669a `select` call is interrupted, but the foreign C code interprets the 
    6770interrupt as an application error and closes a critical file 
     
    6972 
    7073{{{ 
    71 [pid 22338] send(7, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 116, MSG_NOSIGNAL) = 116 
     74[pid 22338] send(7, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 
     75    \0\0\0\0\0\0\0\0\0\0\0"..., 116, MSG_NOSIGNAL) = 116 
    7276[pid 22338] select(8, [7], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted) 
    7377[pid 22338] --- SIGVTALRM (Virtual timer expired) @ 0 (0) --- 
     
    8084 
    8185Once the C code was modified to deal with the interrupt properly, it 
    82 proceeded correctly: 
     86proceeded correctly (note that foreign call is restarted 3 times before it succeeds). 
    8387 
    8488{{{