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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,470e89e7a6575920 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Periodic tasks - organization Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <86589099-2e4e-4b7d-ace0-6f1f864a3fa2@y21g2000hsf.googlegroups.com> <6e0jbhF4o43oU1@mid.individual.net> <561c8fa7-f26d-49a3-b54c-229c20462c04@r66g2000hsg.googlegroups.com> <2172d1a7-39a7-412c-9f30-635054f9103d@q24g2000prf.googlegroups.com> <1jt6gtl169krz.1g52yb1id2u85$.dlg@40tude.net> <4e1a36e7-7c71-4313-89a8-4661a55e59bf@u12g2000prd.googlegroups.com> Date: Sat, 19 Jul 2008 12:22:34 +0200 Message-ID: <15gsr8rk86rqr.1t89j5rkm2aol$.dlg@40tude.net> NNTP-Posting-Date: 19 Jul 2008 12:22:34 CEST NNTP-Posting-Host: 71dd29b8.newsspool3.arcor-online.net X-Trace: DXC=@;0Q0Oa?ZCQcHPTNZh_e7QMcF=Q^Z^V3X4Fo<]lROoRQ8kFC\b4nV[6LHn;2LCV^[O8j6GL30P\76Ie^FL20TU X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:1226 Date: 2008-07-19T12:22:34+02:00 List-Id: On Fri, 18 Jul 2008 18:37:23 -0700 (PDT), Anh Vo wrote: > On Jul 18, 9:22�am, "Dmitry A. Kazakov" > wrote: >> This is IMO not what Maciej wanted, because as Simon has pointed out >> protected procedures are very limited in what they allowed do and in how >> they do it. > > Why is Protected Procedure limited for this purpose? Because it is executed inside a protected action, see RM 9.5.1. In particular, ada-gem-15 is a bounded error, because it calls to Put_Line from a declared protected action. Note that Put_Line is potentially blocking. Even if Put_Line does not block, its execution time is unacceptable for a protected action. Protected actions are thought having *semantically* zero execution time. [Yes, GNAT allows Put_Line in protected actions for debugging purpose, but to do it in production code would be a very bad idea.] >> Another point is that even if that were the context of a task (which is >> not), it still would be an unsatisfactory design, because simultaneously >> triggered actions would block each other when overlapping. > > Again, look at the full code in Ada-Gem-15. There is no overlap action > at all. It would be if there *officially* existed a task doing the notification callbacks. *Unofficially*, depending on the implementation, the compiler might use one task for all instances of Timing_Event or system services (like waitable timers). In both cases you would have one system thread servicing all callbacks one after another. Certainly, an implementation could choose to use one task per each Timing_Event instance, but it would rather be surprising, because there is no reason to do that, as the callback is declared to fit into a protected action. Well, having said that, on a multi-core CPU it could make sense to start one timer task for each core, but I doubt that any Ada vendor would really care. There seems to be little use in Ada.Real_Time.Timing_Events except for bare boards with hardware timer interrupts mapped directly to Timing_Events. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de