comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Interrupts handling in ADA
Date: Tue, 13 Dec 2011 18:14:23 +0000
Date: 2011-12-13T18:14:23+00:00	[thread overview]
Message-ID: <m27h209w5c.fsf@pushface.org> (raw)
In-Reply-To: a0a3106b-e77d-481e-83ae-74e7c51d0376@m7g2000vbc.googlegroups.com

Ada BRL <ada.brl.2011@gmail.com> writes:

> On 13 Dic, 15:07, Simon Wright <si...@pushface.org> wrote:

>> Also, this isn't called an accept statement; it's an entry call. The
>> way a task indicates it's prepared to accept an entry call is by an
>> accept statement; protected objects are different. So if instead of
>> Queue being protected it was a task (not something I'd recommend) the
>> corresponding body part would have looked like
>>
>>    accept Get (M : out Message) when not Buffer.Is_Empty do
>
> I haven't understood you...
> What does it mean "declaring a protected task"? You would not
> recommend it, ok, but what does it mean?
> In the example above is the Buffer (member of main) the unique
> protected object or the main function itself has to be declared as
> protected?
>
> Sorry but I'm beginning to loose the thread...

Not surprised, it seems to me we're giving you answers well above your
current level of knowledge of Ada. Sorry about that.

[1] is a better explanation of tasking & protected types than I can
provide quickly (maybe at all!)

[2] contains two implementations; queueing_po* are the files for a
protected object implementation, queueing_task* for a task
implementation. You will see that the structures of the two main
programs (queueing_po_main, queueing_task_main) are identical.

One of the reasons I wouldn't use a task here is that you have to manage
the active thread of the task. An example of the sort of thing I mean is
that when you run queueing_po_main it stops after 20 ines of output, but
when you run queueing_task_main it hangs at that point and you have to
stop it from the outside (by Crtl-C, for example). The reason is that
the task Queue has no reason to stop and just waits forever (in this
simple case you could probably fix that fairly simply, but in general
it's not easy at all; best to avoid the problem).

[1] http://en.wikibooks.org/wiki/Ada_Programming/Tasking (sections 1, 2)
[2] http://dl.dropbox.com/u/34783908/Ada/queueing.zip



  reply	other threads:[~2011-12-13 18:14 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 20:43 Interrupts handling in ADA Ada @ BRL
2011-12-10 21:13 ` Vinzent Hoefler
2011-12-10 22:09 ` Niklas Holsti
2011-12-10 22:27 ` Simon Wright
2011-12-11 20:21   ` Martin Dowie
2011-12-13 13:51     ` Ada BRL
2011-12-13 23:18       ` Martin Dowie
2011-12-13 14:11     ` Niklas Holsti
2011-12-13 14:54       ` Simon Wright
2011-12-13 15:06         ` Ada BRL
2011-12-13 21:49           ` Niklas Holsti
2011-12-13 23:18       ` Martin Dowie
2011-12-13 12:47   ` Ada BRL
2011-12-13 15:07     ` Simon Wright
2011-12-13 15:23       ` Ada BRL
2011-12-13 18:14         ` Simon Wright [this message]
2011-12-13 18:56           ` Ada BRL
2011-12-13 19:56           ` Bill Findlay
2011-12-13 22:15         ` Niklas Holsti
2011-12-13 15:34       ` Simon Wright
2011-12-13 17:55         ` Ada BRL
2011-12-13 18:18           ` Dmitry A. Kazakov
2011-12-13 19:01             ` Ada BRL
2011-12-13 19:58               ` Dmitry A. Kazakov
2011-12-13 18:24           ` Simon Wright
2011-12-11  0:15 ` Jeffrey Carter
2011-12-13 12:53   ` Ada BRL
2011-12-11  9:23 ` Dmitry A. Kazakov
2011-12-13 13:11   ` Ada BRL
2011-12-13 14:04     ` Dmitry A. Kazakov
2011-12-13 14:51       ` Ada BRL
2011-12-13 15:02         ` Ada BRL
2011-12-13 15:39         ` Dmitry A. Kazakov
2011-12-13 18:51           ` Ada BRL
2011-12-13 19:51             ` Dmitry A. Kazakov
2011-12-13 23:32             ` georg bauhaus
2011-12-11 12:04 ` Georg Bauhaus
2011-12-13 14:08   ` Ada BRL
2011-12-12  3:19 ` anon
2011-12-12  9:12   ` Niklas Holsti
2011-12-13 13:36     ` Ada BRL
2011-12-12 15:23   ` björn lundin
2011-12-13 13:38     ` Ada BRL
2011-12-13 13:56       ` Ludovic Brenta
2011-12-13 14:10         ` Ada BRL
2011-12-13 13:31   ` Ada BRL
replies disabled

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