From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Storage management
Date: Fri, 7 Nov 2008 14:22:36 +0100
Date: 2008-11-07T14:22:36+01:00 [thread overview]
Message-ID: <ca4vs982oouc.1vzco5wh8lrj0.dlg@40tude.net> (raw)
In-Reply-To: 49142285$0$23584$4f793bc4@news.tdc.fi
On Fri, 07 Nov 2008 14:12:30 +0200, Niklas Holsti wrote:
> Dmitry A. Kazakov wrote:
>>
>> But exactly this case is not guaranteed to work, or rather
>> is guaranteed not to work...
>
> Aborting blocking I/O is "guaranteed not to work"? Can you explain
> why? Is this something that has been discussed before on c.l.a.?
I don't know. But I discussed that with AdaCore people. Since the following
does not work with GNAT Pro 6.2 (Windows wavefront):
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_ATC is
begin
Put_Line ("Type");
select
delay 2.0;
Put_Line ("Timed out");
then abort
Put_Line ("You typed " & Get_Line);
end select;
end Test_ATC;
Actually I was almost certain that this were *not* required to work. I only
wished to know if they considered it as nice to have working or not. (:-))
There is no way Ada could abort I/O if the OS does not allow this. Second
to Get_Line, or likely the first wanted case is canceling blocking socket
read. I would give 98% that it never will work with ATC.
>>> Isn't pragma Restrictions (No_Select_Statements) enough?
>>> Or is it too strong, and a new restriction specifically
>>> for ATC would be better?
>>
>> I would prefer pragma Cancelable put on a task. If a task
>> is not cancelable then abort would raise Tasking_Error,
>> and an ATC in the task body would be a compile-time error.
>
> I will leave it to the language experts to comment on that
> suggestion. I assume it would have to forbid ATCs in subprograms
> called from the task, too, which would require some form of
> subprogram-level contract that the subprogram body executes no ATCs.
Or to constrain its use like with the selective accept.
> What about ctrl-C, that is, process abort from the operating
> system? I don't think that users would be happy if Ada applications
> could not be aborted with ctrl-C. Do abort-deferred operations now
> defer ctrl-C, too?
The meaning of ctrl-C depends on the OS. Ada standard cannot mandate that
pressing ctrl-C is equivalent to aborting the environment task in the sense
of "abort" statement. Then usually OS have efficient means to kill a
process preemptively bypassing any "abort deferred" stuff.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2008-11-07 13:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-01 11:13 Storage management Florian Weimer
2008-11-01 22:28 ` Robert A Duff
2008-11-02 14:27 ` Florian Weimer
2008-11-07 1:14 ` Randy Brukardt
2008-11-07 8:30 ` Dmitry A. Kazakov
2008-11-07 9:54 ` Niklas Holsti
2008-11-07 9:20 ` Dmitry A. Kazakov
2008-11-07 12:12 ` Niklas Holsti
2008-11-07 13:22 ` Dmitry A. Kazakov [this message]
2008-11-07 13:28 ` Georg Bauhaus
2008-11-07 14:41 ` Dmitry A. Kazakov
2008-11-10 14:28 ` christoph.grein
2008-11-10 16:08 ` Dmitry A. Kazakov
2008-11-08 11:04 ` sjw
2008-11-08 12:33 ` Dmitry A. Kazakov
2008-11-10 9:34 ` sjw
2008-11-01 22:36 ` sjw
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox