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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b4731a3b5d591abd X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Task Discriminants & Arrays Date: 1997/05/15 Message-ID: #1/1 X-Deja-AN: 241653284 References: <3379C86F.352@this.message> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-05-15T00:00:00+00:00 List-Id: In article <3379C86F.352@this.message>, W. Wesley Groleau (Wes) wrote: >Is it not true that I can read the ID of each task? You can read them. >function "<" ( Left, Right : Discriminated_Task ) return Boolean is >begin > return Left.ID < Right.ID; >end "<" > >-- write Bob Duff's ID function to ensure that all IDs are in A'Range >-- instantiate your favorite sort with the "<" above and Matt's array. >-- declare the array, then sort it. >-- result: A(I).ID = I for all I in A'Range But you can't move the tasks around -- they're limited. You could move pointers to tasks around, but if you're willing to use pointers, you might as well use allocators, and assign the id's you want. I suppose you could have an array of tasks, and an array of pointers to tasks, and sort the latter (and hide the former from clients). The only advantage I can see to that is that it allows parallel activation of the tasks. - Bob