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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a202dd1e3126194b,start X-Google-Attributes: gid103376,public From: Subject: Howto pass reference to protected objects to tasks Date: 1998/09/14 Message-ID: #1/1 X-Deja-AN: 390991820 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: Gerhard-Mercator-Universitaet -GH- Duisburg Mime-Version: 1.0 Reply-To: ajung@uni-duisburg.de Newsgroups: comp.lang.ada Date: 1998-09-14T00:00:00+00:00 List-Id: Hello all, I have a problem implementing the following paradigm : a set of tasks, (i.e. instantiated task types) are to communicate using protected objects. One (assume the main) task should pass a reference to a protected object to the others. The protected object looks something like this : --------------------------------------------------------- generic type item_type is private; package shared_obj is protected type shared_item is procedure reset; procedure set; function data_is_valid return boolean; function read return item_type; procedure write(new_value : item_type); private item : item_type; data_valid : boolean := false; end shared_item; type shared_item_access is access all shared_item; --------------------------------------------------------- My questions are the following : - can I access an object of type shared_item, since I assume that it is a "limited type" ? - one solution I tried, was declaring the following object in the main task (message_type being a character, basically) : --------------------------------------------------------- package message_type_package is new shared_obj(item_type =>message_type); type shared_message_type is new message_type_package.shared_item; apreq_f_message : aliased shared_message_type; --------------------------------------------------------- However, the compiler (which is gnat-3.10p) I used generated the following neat little message : +===========================GNAT BUG DETECTED==============================+ | Error detected at sm.adb:21:9 | | Please submit bug report by email to report@gnat.com | | Use a subject line meaningful to you and us to track the bug | | Include full sources in ASCII in a format compatible with gnatchop | | First line of sources must be marked by an Ada -- comment line | | Last line of sources must be last line of email message (no signature!) | | See gnatinfo.txt file for more info on procedure for submitting bugs | | 3.10p (970814) (i386-linux) Assert_Failure at atree.adb:2432 | +==========================================================================+ compilation abandoned So, is this just due to a compiler bug, that I cannot do what I have in mind, or should that be done in a different way (I mean passing protected objects) ? By the way, the mentioned line 21 was the line in which the aliased type has been declared... Any comments are appreciated, Andreas Andreas Jungmaier, Dipl.-Ing. Gerhard-Mercator-Universitaet-GH Duisburg FB9/DV Bismarckstr. 81, 47048 Duisburg, Germany Tel.: +49 (0203) 379-2728 Fax: +49 (0203) 370439 email: ajung@uni-duisburg.de www.fb9dv.uni-duisburg.de/members/ajung/