From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 6A7797EE25 for ; Tue, 19 Nov 2013 10:21:52 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8CAFssi1ImacjlnGdsb2JhbABZhBK/PIEUHg4BAQEBAQYNCQkUKIIcCQEBBAFAAQE3AQQLCwMBBwM4IhIBBQEcBhOHewYDAqNwiw6EUgEFjkcRBo9XB4QxmBOQIRgphFM X-IPAS-Result: Ah8CAFssi1ImacjlnGdsb2JhbABZhBK/PIEUHg4BAQEBAQYNCQkUKIIcCQEBBAFAAQE3AQQLCwMBBwM4IhIBBQEcBhOHewYDAqNwiw6EUgEFjkcRBo9XB4QxmBOQIRgphFM X-IronPort-AV: E=Sophos;i="4.93,728,1378850400"; d="scan'208";a="43718240" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Nov 2013 10:21:51 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VihVE-00077x-L7 for caml-list@inria.fr; Tue, 19 Nov 2013 04:21:48 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VihVE-0001Th-K1 for caml-list@inria.fr; Tue, 19 Nov 2013 04:21:48 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VihVE-0000Hq-Gb for caml-list@inria.fr; Tue, 19 Nov 2013 04:21:48 -0500 Received: by mail-ie0-f177.google.com with SMTP id tp5so3442527ieb.36 for ; Tue, 19 Nov 2013 01:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ij32T8z3zppDob7vJKu4tmqbxsg/sRbwldUOLCfNlDY=; b=Sw8EIuQO8fTzmvc7SN9ms8pOsXrmatgyHCisM14+OrgONgwdY0/uAF5JXTY95cDeBN eRXOeTpqCv8Ky1T217HQd+edXL2mG2tXZW6zDzBMUlaXWAAlt3Kps3z6ri89KQnLN2D/ ZcCVyVP+h/ad6SFhzoXkYQkyURMJxwpXJjFyE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ij32T8z3zppDob7vJKu4tmqbxsg/sRbwldUOLCfNlDY=; b=jdHYbGvl/MR1jD0rRC5eGZeBv8HQRz9GQ2vEVBXPCDDRMKOQ86zHn9nUhb0LvFUVJ9 rDpYZj377m5FYl2w+G4i4qKKh0tt04P8j7rwtfL7BsWOsE/K5pUpZosgD/eyabMXSVbP 3hLAuzsZoLk2PEz23NQ7IE3qpnOaYU1j+A0Dh0QpM8ldTb24f0wILm9EAOsQYoei3ee2 EwPrh5LGz0F6r2XtIRwgFliIIBOl/Xy7IZ5o+yW1bmzmSSDjVxHoNjhrV9mnzJEaepob 4umQTrsT6LQ39tkD6Wa/JYsho+BU0h2ITqaFIVjJ317EnP1x2v3un0ndl0IgJxmRxIwb pfPw== X-Gm-Message-State: ALoCoQk0wFqu2+vN80eWMKP16rTpchjQenNKeWoXIb1Rd1zuXVhvewsPg6BSOdF9HECf489534t1ZUNt2sR4P2JAdUIrBbNQMtrYsRvhrQjBeQUAE+9J2NtHWUihWXaV99zKkQK4CHtcFQLs/12W0MhHogdMd/JrNg== X-Received: by 10.50.61.205 with SMTP id s13mr18453726igr.29.1384852908284; Tue, 19 Nov 2013 01:21:48 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.61.205 with SMTP id s13mr18453721igr.29.1384852908204; Tue, 19 Nov 2013 01:21:48 -0800 (PST) Received: by 10.50.170.40 with HTTP; Tue, 19 Nov 2013 01:21:48 -0800 (PST) In-Reply-To: <8738mthu88.fsf@golf.niidar.ru> References: <8738mthu88.fsf@golf.niidar.ru> Date: Tue, 19 Nov 2013 09:21:48 +0000 Message-ID: From: Jeremie Dimino To: Ivan Gotovchits Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=047d7bd7679aa9045e04eb843146 Subject: Re: [Caml-list] lwt exceptions and infinite loops --047d7bd7679aa9045e04eb843146 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Nov 19, 2013 at 4:48 AM, Ivan Gotovchits wrote: > consider the following simple example: > > open Lwt > let rec loop () = Lwt_unix.sleep 1. >> loop () > let bad () = Lwt_unix.sleep 1. >> fail Not_found > let () = Lwt_main.run (join [loop (); bad ()]) > > > This program never terminates with an exception as I expect. > > Can someone clarify to me what really happens underneath the hood? > Lwt.join waits for all thread to terminate (with a value or an exception). In this case [loop ()] is still running so the join doesn't terminate. -- Jeremie --047d7bd7679aa9045e04eb843146 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Tue, Nov 19, 2013 at 4:48 AM= , Ivan Gotovchits <ivg@ieee.org> wrote:
consider the following simple example:

=A0 open Lwt
=A0 let rec loop () =3D Lwt_unix.sleep 1. >> loop ()
=A0 let bad () =3D Lwt_unix.sleep 1. >> fail Not_found
=A0 let () =3D Lwt_main.run (join [loop (); bad ()])


This program never terminates with an exception as I expect.

Can someone clarify to me what really happens underneath the hood?

Lwt.join waits for all thread to terminate (with a v= alue or an exception). In this case [loop ()] is still running so the join = doesn't terminate.

--=A0
Jeremie
--047d7bd7679aa9045e04eb843146--