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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bfa293c8cae77433 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-19 19:07:25 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!elnk-nf2-pas!newsfeed.earthlink.net!attbi_feed3!attbi.com!attbi_s54.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: <3fe32ff4$1@news.barak.net.il> Subject: Re: Tasks problem X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 12.211.58.135 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s54 1071889644 12.211.58.135 (Sat, 20 Dec 2003 03:07:24 GMT) NNTP-Posting-Date: Sat, 20 Dec 2003 03:07:24 GMT Organization: Comcast Online Date: Sat, 20 Dec 2003 03:07:24 GMT Xref: archiver1.google.com comp.lang.ada:3606 Date: 2003-12-20T03:07:24+00:00 List-Id: I would probably take a slightly different approach. I would use a protected object to keep track of the highest number checked. The tasks would be declared as an array inside of a procedure (after the protected object). Each task would get the next number to evaluate from a protected procedure inside the protected object. The protected procedure would return a number to evaluate and a flag indicating when all evaluations are done. The tasks would terminate when there are no new numbers to check. The containing procedure would return automagically when all tasks in the array are terminated. This technique does not use a task to "manage" each of the n tasks, they essentially manage themselves. Steve (The Duck) "Ratson Janiv" wrote in message news:3fe32ff4$1@news.barak.net.il... > Hi, > I have a task T_Check that checks if a number is a prime one. > I have a task T_Manager that manages the checks. > In T_Manager I have an array of T_Check(1..N). > > Now, lets say I want the T_Manager task to check the numbers 1..100 if they > are prime. > I have only 8 T_Checks tasks (N=6). > How do I manage the tasks allocations ? > I thought about T_Manager getting a notification from T_Check when it > finishes checking, and when T_Manager is notified it shold recall the Check > entry in the T_CHeck task that notified it. > The problem is that I dont know how to know which task (T_Check) amongst the > Nth tasks has notified me. > Is there any solution in ADA? > Maybe my solution is not so good (Hellllllloooooooooo?), what is the > solution U may suggest me ? > > Thanks a lot, > Janiv Ratson. > > >