comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Task_Barriers
Date: Thu, 25 Jul 2019 18:43:58 +0200
Date: 2019-07-25T18:43:58+02:00	[thread overview]
Message-ID: <qhcm8f$2ic$1@gioia.aioe.org> (raw)
In-Reply-To: e0ed983d-bb8d-4568-8f0b-c6771431e271@googlegroups.com

On 2019-07-25 18:32, Gilbert Gosseyn wrote:
> with Ada.Text_IO , Ada.Synchronous_Barriers ;
> use  Ada.Text_IO , Ada.Synchronous_Barriers ;
> 
> procedure Task_Barriers is
>     NT: constant := 2;
>     SB: Ada.Synchronous_Barriers.Synchronous_Barrier(NT) ;
>     Notified : Boolean:= False ;
>     task T1 ;
>     task T2 ;
> 
>     X: Integer :=0;
>     Y: Integer :=1;
> 
>     task body T1 is
>     begin
>        loop
>           delay 1.0 ;
>           Wait_For_Release (SB,Notified) ;
>           X:=X+1;
>        end loop ;
>     end T1 ;
> 
>     task body T2 is
>     begin
>        loop
>           delay 1.0 ;
>           Wait_For_Release (SB, Notified) ;
>           Y:=Y+1;
>        end loop ;
>     end T2 ;
> begin
>     null ;
> end Task_Barriers ;
> 
> This program runs forever, although it should stop when reaching an internal count number?

 From the description the barrier rearms itself again after releasing 
all tasks D.10.1 (11/3). So, it looks correct behavior to me. Both tasks 
get synchronized at the barrier and then repeat it again each second.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2019-07-25 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 16:32 Task_Barriers Gilbert Gosseyn
2019-07-25 16:43 ` Dmitry A. Kazakov [this message]
2019-07-25 18:56 ` Task_Barriers Dennis Lee Bieber
2019-07-25 20:11   ` Task_Barriers Jeffrey R. Carter
2019-07-25 20:17 ` Task_Barriers Simon Wright
2019-07-25 21:59   ` Task_Barriers Randy Brukardt
2019-07-26  7:52     ` Task_Barriers Simon Wright
2019-07-26 23:59       ` Task_Barriers Dennis Lee Bieber
2019-07-26 10:38   ` Task_Barriers Gilbert Gosseyn
2019-07-26 11:09     ` Task_Barriers Dmitry A. Kazakov
2019-07-26 15:03     ` Task_Barriers Simon Wright
2019-07-27  0:10     ` Task_Barriers Dennis Lee Bieber
replies disabled

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