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!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ravenscar - release multiple tasks when an event occurs Date: Tue, 5 May 2020 19:16:22 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net l271pfBrhBLDvkBe9h7dVgTWUV0a23A582tLn6uNZctON4+3ds Cancel-Lock: sha1:R8OC/md7dCrnsgZmKxJnrxOszTE= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58597 Date: 2020-05-05T19:16:22+03:00 List-Id: On 2020-05-05 19:02, Simon Wright wrote: > 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. Ok. I had in mind a solution where the elaboration of the sensor-task packages is delayed until some other elaboration sets up the good state (even if it takes a while), but if you need other tasks for that, and have Sequential task elaboration, this solution is not possible. >>> 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. Yes, you need a different Suspension_Object for each task to be suspended (concurrently). -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .