comp.lang.ada
 help / color / mirror / Atom feed
From: <ajung@du9ds9.fb9dv.uni-duisburg.de>
Subject: Howto pass reference to protected objects to tasks
Date: 1998/09/14
Date: 1998-09-14T00:00:00+00:00	[thread overview]
Message-ID: <Pine.LNX.3.96.980914134309.23179A-100000@du9ds9.fb9dv.uni-duisburg.de> (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/






             reply	other threads:[~1998-09-14  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-14  0:00 ajung [this message]
1998-09-14  0:00 ` Howto pass reference to protected objects to tasks Tucker Taft
replies disabled

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