Erik de Castro Lopo a écrit : > Hi all, > > I'm doing some systems programming where I need to use threads > (standard threads, not cothreads), signals and events. The program > has a couple of things to do: > > a) Start program X, do a wait on its pid and restart X if it dies > and log information to syslog. > b) Periodically run other system checks and log results to syslog. > Certain types of system failures need to be communicated to > program X so that it can modify its behaviour. > c) Catch SIGHUP, and on reception, kill program X (send SIGHUP first > and if that doesn't work SIGTERM and finally SIGKILL) and then > exit itself. > > Since the system checks can take some time (mostly waiting for the > kernel to do stuff rather than intensive processing) and program X > needs to be restarted immediately if it dies, using threads seems > to be an obvious solution. > > Why not processes and fork ? Christophe -- Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------