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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news3.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-online.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada tasking question Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <20070418201307.18a85fd9@cube.tz.axivion.com> Date: Thu, 19 Apr 2007 09:49:14 +0200 Message-ID: NNTP-Posting-Date: 19 Apr 2007 09:49:14 CEST NNTP-Posting-Host: 4be84e35.newsspool2.arcor-online.net X-Trace: DXC=OjPUob\@YPUcHPTNZh_e7QA9EHlD;3YcR4Fo<]lROoRQ8kF_nOMd9d<[Ym^ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15113 Date: 2007-04-19T09:49:14+02:00 List-Id: It makes no sense to finish a task after a bucket was processed. I would propose an alternative design, where a task would ask the buckets collection for a job to do. It would then process the bucket and ask for a next one. When the collection responds: no more buckets, the task finishes: type Bucket is new Ada.Finalization.[Limited_]Controlled ... procedure Process (Job : in out Bucket); type Bucket_List is record Buckets : Bucket_Array (...); Indexer : a protected object to index buckets concurrently end record; procedure Do_One (List : in out Bucket_List) is begin Process (List.Buckets (List.Indexer.Get_Next)); -- Get_Next raises exception No_Buckets, -- when the end of List.Buckets is reached end Do_One; task body Bucket_Worker is begin loop Do_One (List); end loop; exception when No_Buckets => null; end Bucket_Worker; You start as many Bucket_Workers as you find appropriate. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de