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,5b86cfa15b273e36 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Protected types made of ADT's, and Passive Iterators Date: 1998/09/05 Message-ID: #1/1 X-Deja-AN: 388218459 Sender: matt@mheaney.ni.net References: NNTP-Posting-Date: Sat, 05 Sep 1998 12:13:26 PDT Newsgroups: comp.lang.ada Date: 1998-09-05T00:00:00+00:00 List-Id: woodruff@tanana.llnl.gov (John Woodruff) writes: > Any advice that will make the full facility of passive iterator > available in the task-safe environment? Can you give me a qualitative description of your problem? What's wrong with this: generic with procedure Process (Item : in out Collection_Item; Quit : in out Boolean); procedure Modify_Items (Collection : in out Collection_Type); procedure Modify_Items (Collection : in out Collection_Type) is Quit : Boolean := False; List : List_Type; begin Seize (Collection.Guard); List := Collection.List; for Index in Positive range 1 .. Collection.Number_Of_Items loop Process (List.Item, Quit); exit when Quit; List := List.Next; end loop; Release (Collection.Guard); end Modify_Items; I noticed you used a list. Be careful. I list is a polylithic structure, which is made for structure sharing. Are you sure you don't want a monolithic component (like a collection, or queue, etc)? Your question "How do I make a list task safe?" is a little like asking "What is the sound of one hand clapping?" The question itself is all wrong, because of an "abstraction-level mismatch." Typically, you use a list to implement a container, you don't use a list directly. Make the monolithic container abstraction task safe, not a list abstraction.