comp.lang.ada
 help / color / mirror / Atom feed
* ada.synchronous_barriers incomplete?
@ 2018-05-01 11:26 hnptz
  2018-05-01 12:34 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 2+ messages in thread
From: hnptz @ 2018-05-01 11:26 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ada.synchronous_barriers incomplete?
  2018-05-01 11:26 ada.synchronous_barriers incomplete? hnptz
@ 2018-05-01 12:34 ` Dmitry A. Kazakov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry A. Kazakov @ 2018-05-01 12:34 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-01 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 11:26 ada.synchronous_barriers incomplete? hnptz
2018-05-01 12:34 ` Dmitry A. Kazakov

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