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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed2-b.proxad.net!nnrp1-2.free.fr!not-for-mail From: William FRANCK Newsgroups: comp.lang.ada Date: Mon, 14 Oct 2019 22:48:32 +0200 Message-ID: <5da4df20$0$31420$426a74cc@news.free.fr> References: <5da4cf81$0$20312$426a74cc@news.free.fr> <790bc738-752e-48db-8a8b-b266cffd784f@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: How to transfer Class-Wide object to a Task ? User-Agent: Unison/2.2 Organization: Guest of ProXad - France NNTP-Posting-Date: 14 Oct 2019 22:48:32 CEST NNTP-Posting-Host: 92.184.99.238 X-Trace: 1571086112 news-1.free.fr 31420 92.184.99.238:48233 X-Complaints-To: abuse@proxad.net Xref: reader01.eternal-september.org comp.lang.ada:57282 Date: 2019-10-14T22:48:32+02:00 List-Id: On 2019-10-14 19:55:22 +0000, Shark8 said: > On Monday, October 14, 2019 at 1:41:55 PM UTC-6, William FRANCK wrote: >> Hey all ! >> Here is a nice issue I have with Ada (GNAT 2012) when trying to do OO >> dispatching with streams in different tasks ... > > Generic_Dispatching_Constructor? > https://www.adaic.org/resources/add_content/standards/05rat/html/Rat-2-6.html > > Can you give us the actual use-case you're trying to accomplish? Yes! That's precisly what I'm using to read an existing datafile containing records of 10 different structure (and size), then write each record back to another stream. Purpose is to anonymize some of the fields of differently structured records. Happilly first characters are containing the recordtype name, so I use it as External_Tag and can use the OO dispatching of 'Input and 'Output; selecting the correct 'Read and 'Write. Allin one program (no multitasking) is OK. My issue, is that I wanted to gain some speed by having 2 (Ada) tasks : one for reading, one for writing. I did a simple Proof of Concept for the multitasking by transfering an IntegerObject. This is OK. When I replace my Integer by a class-Wide object, I do find the clue to make it correct.