From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:60c5:: with SMTP id i5mr24338679qtm.268.1595253073126; Mon, 20 Jul 2020 06:51:13 -0700 (PDT) X-Received: by 2002:a05:6830:2056:: with SMTP id f22mr19193828otp.240.1595253072867; Mon, 20 Jul 2020 06:51:12 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 20 Jul 2020 06:51:12 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=208.114.128.41; posting-account=MRPdDAoAAADUJmZVjnYaoafXFMadSeY1 NNTP-Posting-Host: 208.114.128.41 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: 'Number_Of_CPUs' tasks creation, with discriminants, running simultaneously. From: Olivier Henley Injection-Date: Mon, 20 Jul 2020 13:51:13 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:59481 List-Id: Hi everyone, My goal is to distribute similar work across multiple tasks. Incidentally, I want those tasks to start simultaneously, each task having some 'indexed' work (discriminants), and ideally block from main until they are done with their workload. I got this working by declaring the tasks individually. What I would like to achieve is to leverage 'System.Multiprocessors.Number_Of_CPUs' for the number of tasks created. What is the idiomatic way of achieving what I want? I tried with an array of tasks, but the problem becomes I do not know either how to start them simultaneously with parametrization or coordinate their exit point with main. I am lurking for the most 'clean/simple' solution possible. You can see the actual working code fixed at 8 tasks here: https://github.com/ohenley/xph_covid19/blob/master/src/xph_covid19.adb#L280-L287 Thx, Olivier