comp.lang.ada
 help / color / mirror / Atom feed
* Ada 95 protected types and objects for controlled access.
@ 2000-06-01  0:00 dlwester
  0 siblings, 0 replies; only message in thread
From: dlwester @ 2000-06-01  0:00 UTC (permalink / raw)


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.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-06-01  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-01  0:00 Ada 95 protected types and objects for controlled access dlwester

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