From: Ivan Gotovchits <ivg@ieee.org>
To: Jeremie Dimino <jdimino@janestreet.com>
Cc: "caml-list\@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] lwt exceptions and infinite loops
Date: Tue, 19 Nov 2013 16:32:58 +0400 [thread overview]
Message-ID: <87y54kh8qt.fsf@golf.niidar.ru> (raw)
In-Reply-To: <CANhEzE6BAOfkEtVhWuJE9GZFXL4+KHRZ5LKo=AAm05QG+QRZAg@mail.gmail.com> (Jeremie Dimino's message of "Tue, 19 Nov 2013 09:21:48 +0000")
Jeremie Dimino <jdimino@janestreet.com> writes:
> On Tue, Nov 19, 2013 at 4:48 AM, Ivan Gotovchits <ivg@ieee.org> 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
>
Ahh, it seems that I misunderstood the phrase:
«If one of the threads fails, then [join l] will fail with the same
exception as the first one to terminate.»
Thanks alot!
--
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
next prev parent reply other threads:[~2013-11-19 12:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 4:48 Ivan Gotovchits
2013-11-19 9:21 ` Jeremie Dimino
2013-11-19 12:32 ` Ivan Gotovchits [this message]
2013-11-19 11:06 ` Jacques-Pascal Deplaix
2013-11-19 11:11 ` Raphaël Proust
2013-11-19 11:35 ` Jacques-Pascal Deplaix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y54kh8qt.fsf@golf.niidar.ru \
--to=ivg@ieee.org \
--cc=caml-list@inria.fr \
--cc=jdimino@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).