Changes between Version 4 and Version 5 of Commentary/Rts/Signals
- Timestamp:
- 03/04/10 11:06:35 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Rts/Signals
v4 v5 63 63 When using foreign libraries through the Haskell FFI, it is important 64 64 to ensure that the foreign code is capable of dealing with system call 65 interrupts due to alarm signals. For example, in this `strace` output 65 interrupts 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 66 need to be careful how it interprets the time signal from GHC. 67 68 For example, in this `strace` output 66 69 a `select` call is interrupted, but the foreign C code interprets the 67 70 interrupt as an application error and closes a critical file … … 69 72 70 73 {{{ 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 72 76 [pid 22338] select(8, [7], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted) 73 77 [pid 22338] --- SIGVTALRM (Virtual timer expired) @ 0 (0) --- … … 80 84 81 85 Once the C code was modified to deal with the interrupt properly, it 82 proceeded correctly :86 proceeded correctly (note that foreign call is restarted 3 times before it succeeds). 83 87 84 88 {{{
