From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,10d1a90a699d6cfc X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.germany.com!news.belwue.de!news.uni-stuttgart.de!not-for-mail From: Stefan Bellon Newsgroups: comp.lang.ada Subject: Re: Ada tasking question Date: Thu, 19 Apr 2007 00:43:45 +0200 Organization: Comp.Center (RUS), U of Stuttgart, FRG Message-ID: <20070419004345.171ee93e@cube.tz.axivion.com> References: <20070418201307.18a85fd9@cube.tz.axivion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: infosun2.rus.uni-stuttgart.de 1176936187 26785 129.69.226.21 (18 Apr 2007 22:43:07 GMT) X-Complaints-To: news@news.uni-stuttgart.de NNTP-Posting-Date: Wed, 18 Apr 2007 22:43:07 +0000 (UTC) X-Newsreader: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; i486-pc-linux-gnu) X-URL: http://www.axillion.de/ Xref: g2news1.google.com comp.lang.ada:15105 Date: 2007-04-19T00:43:45+02:00 List-Id: Jeffrey R. Carter wrote: > Randy Brukardt wrote: > > > > I'd suggest organizing the tasks as workers and the buckets as > > jobs. The idea is that each task is a loop that just gets a job (a > > bucket in your case), processes it, sends the result, and gets > > another job, etc. You just need a protected data structure to serve > > the jobs, and an array of worker tasks, and then you can easy vary > > N to any value you want to try. Thanks for this excellent idea! I have implemented that now. > In this case, I'd say all that's needed is a protected object to > supply the index into the Buckets array of the next bucket needing > processing. Yes, in fact I already implemented it this way before I saw your posting. :-) protected Bucket_Jobs is procedure Init (Index : in Integer); entry Next (Index : out Integer); private Current : Integer; end Bucket_Jobs; protected body Bucket_Jobs is procedure Init (Index : in Integer) is begin Current := Index; end Init; entry Next (Index : out Integer) when True is begin Index := Current; Current := Current + 1; end Next; end Bucket_Jobs; Initialization is done with Bucket_Jobs.Init (Buckets'First) and the tasks themselves check for Current in Buckets'Range. It kind of works, but I experience some other strange effect (see my reply to Leif Holmgren). -- Stefan Bellon