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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: How to do multiple instances of a generic packages in automated way. (using ravenscar profile) Date: Tue, 5 Apr 2016 10:39:04 -0700 Organization: A noiseless patient Spider Message-ID: References: <56ff6352-590e-4de7-a361-bc2fec0538fb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 5 Apr 2016 17:35:50 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="31427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o6W+stehWzXE49ut8YIBANeGMtaNt0Rs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <56ff6352-590e-4de7-a361-bc2fec0538fb@googlegroups.com> Cancel-Lock: sha1:/PzoAED8aA9jAvOs/BDtgruuVO8= Xref: news.eternal-september.org comp.lang.ada:30000 Date: 2016-04-05T10:39:04-07:00 List-Id: On 04/05/2016 10:09 AM, danielnorberto@gmail.com wrote: > > I have a generic package with a buffer functionality encapsulated using > Ravenscar pragma profile. > > This buffer has also a protected procedures an entries for multitasking. > > I need to instantiate several of this packages. In this moment the code is > working in this way: > > The problem is that i will need a quantity up to 500 or 1000 independent > buffers packages, so i'm trying to think in other way to instantiate this > generics packages than fill 500 or 1000 lines of instances. Without knowing more about your hundreds of buffers, what purpose(s) they serve, how they're similar and how they differ, I can't provide any useful advice. I won't let that stop me, though. Typically, task-safe buffers are used to allow asynchronous communications between tasks. Typically the buffer is a protected type, and once instantiated for the type of information passed in the buffer, multiple objects of the type can be declared (in an array, for example). If you're using Ada 12, then the standard synchronized-queue containers can serve this purpose (assuming they meet all your requirements, including the Ravenscar restrictions). If you're using an earlier version of the language, then you could use something like PragmARC.Queue_Unbounded_Blocking. The synchronized queues are described in ARM A.18.27-29 http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-A-18-27.html The PragmAda Reusable Components are available at https://pragmada.x10hosting.com/pragmarc.htm or through the copy at GitHub https://github.com/jrcarter/PragmARC If neither of these is suitable for your needs, nor gives you an insight into a way to meet your needs, then you can provide more information, including your generic pkg spec and the details of some of the actual generic parameters used to instantiate a couple of the instances, and perhaps we can see an alternative approach. -- Jeff Carter "Nobody expects the Spanish Inquisition!" Monty Python's Flying Circus 22