comp.lang.ada
 help / color / mirror / Atom feed
From: dlwester <dlwesterNOdlSPAM@hotmail.com.invalid>
Subject: Ada 95 protected types and objects for controlled access.
Date: 2000/06/01
Date: 2000-06-01T00:00:00+00:00	[thread overview]
Message-ID: <26813808.5e7ae0d1@usw-ex0101-006.remarq.com> (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!





                 reply	other threads:[~2000-06-01  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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