comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ravenscar vs selective wait
Date: Tue, 24 Mar 2015 06:48:27 +0000
Date: 2015-03-24T06:48:27+00:00	[thread overview]
Message-ID: <lyk2y6vqkk.fsf@pushface.org> (raw)
In-Reply-To: lyoanjv0g6.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> Is it possible to construct an analog of the selective wait using the
> Ravenscar profile?
>
>    Turn_On_The_Lamp;
>    Next := Clock + Milliseconds (500);
>    select
>       accept Reset do
>          Next := Clock + Milliseconds (500);
>       end Reset;
>    or
>       delay until Next;
>       Turn_Off_The_Lamp;
>    end select;

This is rather simplified from what I want to achieve, and I can think
of an ugly solution for it.

   Turn_On_The_Lamp;
   Next := Clock + Milliseconds (500);  -- Next is a shared variable
   loop
      delay until Next;
      if Next <= Clock then
         exit;
      else
         -- something else in the program has updated Next
      end if;
   end loop;
   Turn_Off_The_Lamp;

But what if I need the next wake-up to be *earlier*?
   


  reply	other threads:[~2015-03-24  6:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 22:00 Ravenscar vs selective wait Simon Wright
2015-03-24  6:48 ` Simon Wright [this message]
2015-03-24  7:25   ` Jeffrey Carter
2015-03-24  9:21     ` J-P. Rosen
2015-03-24 17:16       ` Jeffrey Carter
2015-03-24 20:12       ` 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