From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bdf72b2364b0da13 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.73.229 with SMTP id o5mr13259929pbv.7.1323802660972; Tue, 13 Dec 2011 10:57:40 -0800 (PST) Path: lh20ni18690pbb.0!nntp.google.com!news2.google.com!postnews.google.com!w3g2000vbw.googlegroups.com!not-for-mail From: Ada BRL Newsgroups: comp.lang.ada Subject: Re: Interrupts handling in ADA Date: Tue, 13 Dec 2011 10:56:10 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <30143086.6.1323549838421.JavaMail.geo-discussion-forums@vbbfq24> <6df577eb-9c6a-4f82-95e4-817f6ad1ba6e@r6g2000yqr.googlegroups.com> NNTP-Posting-Host: 86.169.132.157 Mime-Version: 1.0 X-Trace: posting.google.com 1323802660 22404 127.0.0.1 (13 Dec 2011 18:57:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 13 Dec 2011 18:57:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w3g2000vbw.googlegroups.com; posting-host=86.169.132.157; posting-account=yig7mwoAAAAAcduNbH7Dpal1sjCSAijA User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKUARELSC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-12-13T10:56:10-08:00 List-Id: On 13 Dic, 18:14, Simon Wright wrote: > Ada BRL writes: > > On 13 Dic, 15:07, Simon Wright 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 > > >> =A0 =A0accept 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 Yes, I have never worked with Ada...but it's good for me to have people explaining real world programs instead of dummy ones... :-), it makes me learning more! I have to read carefully the wikibook about Ada, this will be useful!