From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id E9B7CBC57 for ; Mon, 16 Aug 2010 15:43:59 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIBAMvcaEzRVdg0kGdsb2JhbACDFZ0lCBUBAQEBCQkMBxEDH6EUiFSCToYHiQIBAQMFgSGDInMEiWKINQ X-IronPort-AV: E=Sophos;i="4.55,376,1278280800"; d="scan'208";a="57391882" Received: from mail-qw0-f52.google.com ([209.85.216.52]) by mail2-smtp-roc.national.inria.fr with ESMTP; 16 Aug 2010 15:43:59 +0200 Received: by qwj8 with SMTP id 8so5561696qwj.39 for ; Mon, 16 Aug 2010 06:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=SbvxaTauG5FBO/9UjE53N0xXMx2f0CMwbPmClqppw0A=; b=M/SA4VAf+V7Eyx+LI1+jfFNGte3X6bcpZqcS65he4YfzHW3TQxEjFRkNYLzQzX2mY2 UOQgbAY0C7ZGAjQb8cSH3A8mZwccbj2hPPXzG5+hYe8yUPMVnH5DBtMgcgJf6oF5bZtC q3/wHwMXAUXN2OjkPs9I7W0j9vWyJQahdkuZ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=h1fNjOdgFM8cJ+0ZereLIz/OXXX9/n03jV4jRhM3r1IExYpy5oWfy6mg3g1QgKxKxf UKzWkkS4X13T7ZcKQU6F0et1BsIDaRnPMQNxkLxut1hpHN/bFrPQUsyfstN8R4OeicpW pBIGNohPmFSq1XNuliRqllZ1jSZsxd4qH6Jwo= MIME-Version: 1.0 Received: by 10.229.1.93 with SMTP id 29mr128917qce.293.1281966238299; Mon, 16 Aug 2010 06:43:58 -0700 (PDT) Sender: daniel.c.buenzli@gmail.com Received: by 10.229.71.9 with HTTP; Mon, 16 Aug 2010 06:43:58 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Aug 2010 15:43:58 +0200 X-Google-Sender-Auth: bF1j39-_mksOm_3V2LBrM7wpCOs Message-ID: Subject: Re: [Caml-list] Thread.delay afraid of SIGTERM From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: Paolo Donadeo Cc: OCaml mailing list Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; sigterm:01 buenzli:01 val:01 abbreviation:01 eintr:01 eintr:01 ocaml:01 threads:01 threads:01 unix:01 unix:01 caml-list:01 portability:02 primitive:02 latter:03 Paolo, >>From http://ocamlunix.forge.ocamlcore.org/threads.html#htoc63 : val delay : float -> unit This primitive is provided for portability with vm-level threads, but delay s is simply an abbreviation for ignore (Unix.select [] [] [] s). This call, unlike join, is not restarted when it is interrupted by a signal. So the error you see here is Unix.EINTR: the call to select in delay is interrupted by your signal. For more information about Unix.EINTR : http://ocamlunix.forge.ocamlcore.org/signals.html#sec/sigsyscalls As for the difference with Unix.sleep, the latter does not raise EINTR on signal interruption it just returns earlier with the unslept amount (which is not reported in OCaml), see sleep(3). Best, Daniel