comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ravenscar - release multiple tasks when an event occurs
Date: Tue, 5 May 2020 19:16:22 +0300
Date: 2020-05-05T19:16:22+03:00	[thread overview]
Message-ID: <hhdhqmFhv21U1@mid.individual.net> (raw)
In-Reply-To: <lymu6mfjyk.fsf@pushface.org>

On 2020-05-05 19:02, Simon Wright wrote:
> Niklas Holsti <niklas.holsti@tidorum.invalid> 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
       .      @       .

  reply	other threads:[~2020-05-05 16:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 10:43 Ravenscar - release multiple tasks when an event occurs Simon Wright
2020-05-03 11:50 ` Niklas Holsti
2020-05-05 16:02   ` Simon Wright
2020-05-05 16:16     ` Niklas Holsti [this message]
2020-05-03 14:45 ` Jere
2020-05-05 16:05   ` Simon Wright
2020-05-03 15:09 ` J-P. Rosen
2020-05-05 16:11   ` Simon Wright
2020-05-05 17:02     ` Niklas Holsti
2020-05-03 15:13 ` Jeffrey R. Carter
2020-05-05 16:12   ` Simon Wright
2020-05-05 16:22 ` Simon Wright
replies disabled

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