comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: How to make a task wait and resume ?
Date: Thu, 17 Jan 2019 08:21:24 -0800 (PST)
Date: 2019-01-17T08:21:24-08:00	[thread overview]
Message-ID: <949cfe5a-38ee-49bc-81c6-4fa8e4223289@googlegroups.com> (raw)

Hi there,

I have used a protected object to control (from "outside") 
wait/resume of a task. It works, but is it good practise?

Below is an illustration on what I mean. Hope you get it :-)

reinert  

   protected pause1 is
     entry wait1;
     procedure halt1;
     procedure resume1;
   private
     OK : boolean := false;
   end pause1;

   protected body pause1 is

     entry wait1 when OK is
     begin
        null;
     end wait1;

     procedure halt1 is
     begin
       OK := false;
     end halt1;

     procedure resume1 is
     begin
       OK := true;
     end resume1;
   end pause1;

   task body task1 is 
   begin
     loop
       pause1.wait1;
       do_something;
     end loop;
   end task1;


             reply	other threads:[~2019-01-17 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 16:21 reinert [this message]
2019-01-17 17:28 ` How to make a task wait and resume ? Dmitry A. Kazakov
2019-01-17 22:28   ` Randy Brukardt
2019-01-18  7:59     ` reinert
2019-01-18 10:20       ` Dmitry A. Kazakov
replies disabled

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