From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Tail recursion upon task destruction
Date: Wed, 18 Nov 2009 18:48:06 +0100
Date: 2009-11-18T18:48:03+01:00 [thread overview]
Message-ID: <1mj5dhshzuav0$.nccdkbhdtfn9$.dlg@40tude.net> (raw)
In-Reply-To: Pine.LNX.4.64.0911181113290.8520@medsec1.medien.uni-weimar.de
On Wed, 18 Nov 2009 11:31:59 +0100, stefan-lucks@see-the.signature wrote:
> On Wed, 18 Nov 2009, Dmitry A. Kazakov wrote:
>
>> Now consider a case when the last screw is removed from the device. This
>> is an operation eventually serviced by the device driver. I.e. within
>> the device driver, you see, it was the last screw of the device and *if*
>> there is no other references to the device, it must fall apart. This is
>> a case where you wanted the device to commit suicide. There is nobody
>> else out there to do this. The device is dangling. This is not the only
>> use case, just one possible case.
>
> OK, so you have a task (a device) which notices that it is no longer
> useful. You would like such a task to do some cleanup and to commit
> "suicide". Unfortunately, it can't do the cleanup after the "suicide",
> because it is "dead" then. And it can't cleanup itself before being
> "dead" because it needs its local memory until the very moment of its
> "death".
>
> But couldn't you just use (or maybe abuse) the features from
> Ada.Task_Termination to do perform the cleanup, after the task has died?
> Even if it the "death" is not by suicide (apart from
> "suicide" = regular termination, the options are "murder" = abort and
> "accident" = unhandled exception).
> See <http://www.adaic.org/standards/05rat/html/Rat-5-2.html#I1150>.
Yes, it is an interesting option. One could terminate the task and from the
handler kill the object. The difficulty is that Ada.Task_Termination is not
generic. It is not possible to pass a reference to the object to the
handler.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2009-11-18 17:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-17 10:17 Tail recursion upon task destruction Dmitry A. Kazakov
2009-11-17 21:38 ` Randy Brukardt
2009-11-18 8:41 ` Dmitry A. Kazakov
2009-11-18 10:31 ` stefan-lucks
2009-11-18 17:48 ` Dmitry A. Kazakov [this message]
2009-11-19 9:25 ` Egil Høvik
2009-11-18 11:02 ` Georg Bauhaus
2009-11-18 13:29 ` 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