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: a07f3367d7,8fa1dddecbe9cd04 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!d23g2000vbm.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: How to determine if task is busy or not? Date: Sat, 8 Aug 2009 03:56:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <063cfc19-a8fa-41af-b948-d4f8540cb2ab@o36g2000vbl.googlegroups.com> NNTP-Posting-Host: 94.108.252.217 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1249728971 9517 127.0.0.1 (8 Aug 2009 10:56:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 8 Aug 2009 10:56:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d23g2000vbm.googlegroups.com; posting-host=94.108.252.217; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009061208 Iceweasel/3.0.12 (Debian-3.0.12-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7657 Date: 2009-08-08T03:56:11-07:00 List-Id: Tomek Walkuski wrote: > Is there any way to determine if task is busy or not? > > I have pool of worker tasks and I want to choose one of them to give > some work to do. I don't think you should see the problem in these terms. You don't have to select a task from the pool; the tasks select themselves as they become available for a new job, e.g. each task would look like loop Queue.Get_Next (Job); Process (Job); end loop; where Queue is a protected object and Get_Next removes a job from it and passes it to the task. Of course, if there are no jobs in the queue, it blocks until one arrives. HTH -- Ludovic Brenta.