Ludovic Courtès skribis: > But this illustrates another problem: in the child process, right before > ‘execve’, the finalization thread may be restarted, in which case it > creates a new pipe. > > In the example below, the finalization pipe is on FDs 9 and 7, but > ‘install-current-ports!’ blindly dups to FD 7, thereby closing one end > of the finalization pipe that was just created: The hack below addresses that (mostly) by reserving low-number file descriptors before the signal and finalization threads create their pipe. (In practice, we can only reserve FDs above 5; FDs 3 and 4 are the “sleep pipe” I believe.) It seems to be good enough though. Thoughts? Ludo’.