comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Is Text_IO.Put_Line() thread-safe?
Date: Thu, 14 Jun 2012 21:14:25 +0000 (UTC)
Date: 2012-06-14T21:14:25+00:00	[thread overview]
Message-ID: <jrdk7h$bjp$1@speranza.aioe.org> (raw)
In-Reply-To: e9ck9h3fhhdz$.14u3tg094wfed.dlg@40tude.net

> > It's a good idea to put an exception handler at the bottom of every
> > task body, and do some debugging output there.  Otherwise, an
> > exception will cause the task to silently vanish.  This is a
> > language design flaw.
>
> It would be nice if the exception would propagate in the task's master,

  Not quite the same, but possibly useful:

with Ada.Exceptions;
procedure Testte is
  task type T is
    entry A;
    entry B(I : in Integer);
    entry C;
  end;
  task body T is
    Dummy : Natural := 1;
  begin
    accept A;
    select
      accept C;
    or
      delay 3.0;
    end select;
    Dummy := Dummy - 2; -- cause exception
  exception
    when Surprise: others =>
      declare
        use Ada.Exceptions;
        Ea : Exception_Occurrence_Access := Save_Occurrence(Surprise);
      begin
        select
          accept A do Reraise_Occurrence(Ea.all);end;
        or
          accept B(I : in Integer) do Reraise_Occurrence(Ea.all);end;
        or
          accept C do Reraise_Occurrence(Ea.all);end;
        or
          terminate; -- died and nobody noticed!
        end select;
      end;
  end T;
  This : T;
begin
  This.A;
  This.C;  -- will cause This to have an internal, post-rendezvous, exception
  This.A;  -- The next call on This will get that saved exception
end Testte;



  parent reply	other threads:[~2012-06-14 21:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 12:53 Is Text_IO.Put_Line() thread-safe? awdorrin
2012-06-14 13:49 ` Robert A Duff
2012-06-14 14:35   ` Adam Beneschan
2012-06-14 14:38   ` Dmitry A. Kazakov
2012-06-14 14:56     ` J-P. Rosen
2012-06-14 16:01       ` Dmitry A. Kazakov
2012-06-14 18:34       ` Robert A Duff
2012-06-21 19:01         ` Randy Brukardt
2012-06-14 18:29     ` Robert A Duff
2012-06-21 19:04       ` Randy Brukardt
2012-06-14 21:14     ` tmoran [this message]
2012-06-14 14:42   ` awdorrin
2012-06-14 18:24     ` Robert A Duff
2012-06-14 20:37       ` awdorrin
2012-06-14 21:37         ` Robert A Duff
2012-06-15  5:32           ` Georg Bauhaus
2012-06-15  7:22             ` Dmitry A. Kazakov
2012-06-15 21:32               ` Robert A Duff
2012-06-16  7:41                 ` Dmitry A. Kazakov
2012-06-15 21:27             ` Robert A Duff
2012-06-14 18:56 ` Jeffrey Carter
2012-06-14 20:50   ` awdorrin
2012-06-14 21:41     ` Robert A Duff
2012-06-15 12:39       ` awdorrin
2012-06-14 22:17     ` Jeffrey Carter
2012-06-14 22:40       ` Simon Wright
2012-06-14 23:35         ` Jeffrey Carter
2012-06-15  5:04           ` Simon Wright
2012-06-15  5:41             ` Jeffrey Carter
2012-06-21 19:20             ` Randy Brukardt
2012-06-16  2:00       ` BrianG
2012-06-16  6:04         ` J-P. Rosen
2012-06-16  6:49           ` Simon Wright
2012-06-16  7:58             ` Dmitry A. Kazakov
2012-06-16  8:03               ` Simon Wright
2012-06-16  8:14                 ` Dmitry A. Kazakov
2012-06-21 19:27               ` Randy Brukardt
2012-06-16  7:51           ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox