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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.BbH97sg9o6mM6D9Le5/JeQ.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ravenscar - release multiple tasks when an event occurs Date: Tue, 05 May 2020 17:02:59 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: BbH97sg9o6mM6D9Le5/JeQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:ZkBMJyOAph83GWyTdl1UxYqqllg= Xref: reader01.eternal-september.org comp.lang.ada:58593 Date: 2020-05-05T17:02:59+01:00 List-Id: Niklas Holsti writes: > On 2020-05-03 13:43, Simon Wright wrote: >> I have several sensor tasks (in general, 2 at the moment) which will of >> course be created and start execution during elaboration. > > Depends on the value specified for pragma > Partition_Elaboration_Policy. If it is Sequential, the tasks start > only after (most of) elaboration is completed -- RM H.6. Indeed, I'd forgotten that. The top level of the code has SPARK_Mode, and I'm fairly sure that requires Sequential. I have Partition_Elaboration_Policy (Sequential), anyway. >> I'd like to ensure that they don't actually start reading and reporting >> input data until the system is in a state to receive them. > > How/when does the system reach that state? At end of elaboration, or > at some much later time? Should other tasks execute before that state > is reached? Some later time, and indeed other tasks do execute first. >> With the Ravenscar profile it's not obvious how to do this (only one >> entry per PO, only one task allowed to queue). > > You can of course create a special protected object for each sensor > task that has an entry "wait until system in good state" and a > procedure "declare system in good state" to open that entry. > > Or you could do the same with Suspension_Objects from > Ada.Synchronous_Task_Control (but Gnat implements them as protected > objects anyway, I think). I think those suffer from the same problem.