comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ada.synchronous_barriers incomplete?
Date: Tue, 1 May 2018 14:34:15 +0200
Date: 2018-05-01T14:34:15+02:00	[thread overview]
Message-ID: <pc9ms6$1kv6$1@gioia.aioe.org> (raw)
In-Reply-To: 40f83198-ee2d-4c1f-8066-d333b9bed30c@googlegroups.com

On 2018-05-01 13:26, hnptz@yahoo.de wrote:
> The rationale_2102 says: "There are many situations where the release of N tasks is required to execute an algorithm in parallel". My question is how to stop N-1 tasks after one of the N tasks has found the required solution before all other N-1 taks?

An atomic Boolean set true by the first task reaching the solution? 
Other task can periodically check the value.

Or it could be the asynchronous transfer of control if the tasks do only 
computations:

    task body Worker is
    begin
       select
          Ready.Wait; -- Protected object implementation of an event
       then abort
          loop -- Incredibly long computations
             ...
             exit when Converged;
             ...
          end loop;
          Ready.Signal; -- I am the first!
       end select;
    end Worker;

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


      reply	other threads:[~2018-05-01 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 11:26 ada.synchronous_barriers incomplete? hnptz
2018-05-01 12:34 ` Dmitry A. Kazakov [this message]
replies disabled

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