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,ec4a7355f321a22b X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!nntp.giganews.com.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 21 May 2004 11:46:24 -0500 Date: Fri, 21 May 2004 12:46:23 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Task discriminants References: <40ACC50E.9040406@mail.usyd.edu.au> <3191556.otblUWQ27X@linux1.krischik.com> In-Reply-To: <3191556.otblUWQ27X@linux1.krischik.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-Ec5wLJBfk/Zp3UU6po0aacpLCiQAPjxfDbkUQrealc5J7NFmT7t3ZVl4nAIpxTGWktrbz7OYl3jeOnm!YIqBolRUxS3Lx0nk/2VVpccZsUfLq8ImNH8QYb/rVycomIMjGSXtBHc6C7Uphg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: controlnews3.google.com comp.lang.ada:748 Date: 2004-05-21T12:46:23-04:00 List-Id: Martin Krischik wrote: > Of corse not! Tasks are indefinite type and can't be stored in arrays. You > can store an access to a task in an array. No, you certainly can have arrays of tasks, even arrays of tasks with discriminants. But you can't have an array of tasks with different discriminants, only because there is no way to initialize it. You can wait for Ada 2005, use an array of access types, or if you prefer an array of Task_IDs. > PS: I could not find anything in the RM: Does anybody know if task are also > limited. Yes they are. See RM 9.1(21). As to solving the problem that started this discussion, my preferred solution is to have an array of access values, and have a function that initializes the array by creating the (discriminated) tasks and returning the array. You go through a loop of: for I in 1..Max loop Result(I) := new Task_Type(I); end loop; That way the task 'knows' its position in the array. If you have a large distributed system though, you want to use a tree where Task_Type(J) first registers itself, then creates Task_Type(2*J) and Task_Type(2*J+1), assuming that 2*J < Max. This allows the work of creating the tasks can be distributed to multiple processors. -- Robert I. Eachus "The terrorists rejoice in the killing of the innocent, and have promised similar violence against Americans, against all free peoples, and against any Muslims who reject their ideology of murder. Their barbarism cannot be appeased, and their hatred cannot be satisfied. There's only one way to deal with terror: We must confront the enemy and stay on the offensive until these killers are defeated." -- George W. Bush