Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ncar!gatech!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!chx400!sicsun!disuns2!elcgl.epfl.ch!madmats From: madmats@elcgl.epfl.ch Newsgroups: comp.lang.ada Subject: Re: Hiding Concurrency Message-ID: <1991Apr19.031148.1@elcgl.epfl.ch> Date: 19 Apr 91 02:11:48 GMT References: <1991Apr15.211346.15760@cs.odu.edu> Sender: news@disuns2.epfl.ch Followup-To: comp.lang.c++ Organization: Ecole Polytechnique Federale de Lausanne Lines: 34 In article , jls@rutabaga.Rational.COM (Jim Showalter) writes: > Why did you use semaphores instead of tasking for this problem? > If you had used tasking, your concurrency problems would have > gone away--that is, after all, what tasking is FOR. Because tasks can only be accessed through entries, and composite ADTs often require iterators (implemented as generic procedures in non-concurrent ADTs). For instance, try to convert this to a concurrent ADT without using semaphores: generic type Item_Type is private; with function "<" (Left, Right : Item_Type) return Boolean is <>; package Sets is type Set is limited private; procedure Insert (Item : in Item_Type; Into : in out Set); procedure Remove (Item : in Item_Type; From : in out Set); generic with procedure Action (Item : in Item_Type); procedure Enumerate (The_Set : in Set); end Sets; You will have much trouble specifying Enumerate as a task entry (not to speak of implementation, as Enumerate will be recursive if the Sets are implemented as binary trees). Mats