comp.lang.ada
 help / color / mirror / Atom feed
* Howto pass reference to protected objects to tasks
@ 1998-09-14  0:00 ajung
  1998-09-14  0:00 ` Tucker Taft
  0 siblings, 1 reply; 2+ messages in thread
From: ajung @ 1998-09-14  0:00 UTC (permalink / raw)


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/






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Howto pass reference to protected objects to tasks
  1998-09-14  0:00 Howto pass reference to protected objects to tasks ajung
@ 1998-09-14  0:00 ` Tucker Taft
  0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 1998-09-14  0:00 UTC (permalink / raw)


ajung@du9ds9.fb9dv.uni-duisburg.de wrote:

: ...
: My questions are the following :
: - can I access an object of type shared_item, since I assume that it
:   is a "limited type" ?

Yes, you can use a limited type as the designated type of an access type.

: ...
:   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...

Your code looks fine, but it seems to have hit a compiler bug.
You might try simplifying the test case to try to determine
exactly what you are doing is hitting the bug.  You might
be able to work around it.

: 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/

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-09-14  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-14  0:00 Howto pass reference to protected objects to tasks ajung
1998-09-14  0:00 ` Tucker Taft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox