From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: Caml-list@yquem.inria.fr Delivered-To: Caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id D4FF7BBCA for ; Fri, 15 Feb 2008 07:47:26 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAG7EtEfUGypAi2dsb2JhbACBWY5yAQEBCAQGCQgRB54L X-IronPort-AV: E=Sophos;i="4.25,356,1199660400"; d="asc'?vcf'?scan'208";a="8111709" Received: from smtp7-g19.free.fr ([212.27.42.64]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Feb 2008 07:47:26 +0100 Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id 362C0322820; Fri, 15 Feb 2008 07:47:26 +0100 (CET) Received: from Tocksi.local (lns-bzn-48f-81-56-220-129.adsl.proxad.net [81.56.220.129]) by smtp7-g19.free.fr (Postfix) with ESMTP id ED44D32281C; Fri, 15 Feb 2008 07:47:25 +0100 (CET) Message-ID: <47B53579.6070109@univ-savoie.fr> Date: Fri, 15 Feb 2008 07:47:21 +0100 From: Christophe Raffalli User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Erik de Castro Lopo Cc: Caml-list@yquem.inria.fr Subject: Re: [Caml-list] Threads, Signals and Events References: <20080215091910.bb982431.mle+ocaml@mega-nerd.com> In-Reply-To: <20080215091910.bb982431.mle+ocaml@mega-nerd.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7EDEFC4EFF1C5F1641501D51" X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 syslog:01 syslog:01 sigterm:01 chablais:01 73376:01 univ-savoie:01 threads:01 threads:01 lama:01 caml-list:01 X-Attachments: cset="utf-8" name="Christophe_Raffalli.vcf" name="Christophe_Raffalli.vcf" type="application/pgp-signature" name="signature.asc" name="signature.asc" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7EDEFC4EFF1C5F1641501D51 Content-Type: multipart/mixed; boundary="------------020901020402040008090607" This is a multi-part message in MIME format. --------------020901020402040008090607 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Erik de Castro Lopo a =E9crit : > 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=20 > to be an obvious solution. > > =20 Why not processes and fork ? Christophe --=20 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=20 can check this signature. The public key is stored on www.keyserver.net --------------------------------------------- --------------020901020402040008090607 Content-Type: text/x-vcard; charset=utf-8; name="Christophe_Raffalli.vcf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Christophe_Raffalli.vcf" begin:vcard fn:Christophe Raffalli n:Raffalli;Christophe org:LAMA (UMR 5127) email;internet:christophe.raffalli@univ-savoie.fr title;quoted-printable:Ma=3DC3=3DAEtre de conf=3DC3=3DA9rences tel;work:+33 4 79 75 81 03 note:http://www.lama.univ-savoie.fr/~raffalli x-mozilla-html:TRUE version:2.1 end:vcard --------------020901020402040008090607-- --------------enig7EDEFC4EFF1C5F1641501D51 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHtTV9i9jr/RgYAS4RAlNtAJ9a+J1Qv1OZ7VKwSvmJP46DCeUsnACgnQ0/ /cXKNPPNi2ofQ+hQUehPOdc= =lXO9 -----END PGP SIGNATURE----- --------------enig7EDEFC4EFF1C5F1641501D51--