Ada 95 protected types and objects for controlled access. 
Author Message
 Ada 95 protected types and objects for controlled access.

The LRM is not very clear on some aspects of protected types.  I
understand how to create a type with protected data.  I'm not
quite sure what is needed to simply protect a thread.

For instance, assuming the procedure 'Send_Data(x : in integer)'
must not be interrupted (because it is not re-entrant, bad
programing, etc.).

Will the following protect the procedure from being interrupted
by a higher level task calling it?

protected Controlled_Access is
  procedure Controlled_Send(X : in Integer);
end Controlled_Access;

protected body Controlled_Access is

  procedure Controlled_Send(X : in Integer) is
  begin
    Send_Data(X : in Integer);  -- The non-reentrant procedure.
  end Controlled_Send;

end Controlled_Access;

..
..

   Controlled_Access.Controlled_Send(10);

..
..

The alternative is to just make a controlled type and declare a
variable to do the same stuff as above but the compiler does
accept the above syntax that leads me to believe the above
example is acceptable.

Off Topic - Unbelievably the Rational Apex Ada NT compiler starts
a new task for every protected object.  The quality of Apex Ada
compilers are really quite questionable.

Thanks in advance.
Don Westermeyer

* Sent from RemarQ http://www.*-*-*.com/ The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Mon, 18 Nov 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. C++ protected member behaviour in Ada 95

2. LGL Seminar: GNU Ada 95 and Mixed Language Programming with Ada 95

3. LGL Seminar: GNU Ada 95 and Mixed Language Programming with Ada 95

4. Design Question: How Best To Structure Cross-Referencing Types In Ada 95

5. Ada 95 Modular Types Question 4.5.1(2)

6. Ada 95 problem with 'access

7. Create COM objects with Ada 95

8. Talk in San Diego: JOOP columninst Richard Riehle on Ada 95 and Object-Oriented Programming

9. Concurrent Objects in Ada 95

10. type is access cf type is access all?

11. Semantics of Protected Types in ADA 9X?

12. Ada Protected Object Tutorial #1

 

 
Powered by phpBB® Forum Software