comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <eachus@mitre.org>
Subject: Re: Self-referential types
Date: 1999/10/19
Date: 1999-10-19T18:09:24+00:00	[thread overview]
Message-ID: <380CB50C.2DB70690@mitre.org> (raw)
In-Reply-To: 7udsva$m0t$1@nnrp1.deja.com



Robert Dewar wrote:
  
> Ah ha! There it is. The trouble is that the creator may not
> think tasking is an issue, but later on a consumer is interested
> in task safety. PLEASE PLEASE default your thinking to assume
> that tasking *is* an issue, and make thinks task safe by
> default. Only introduce (well documented!) thread non-safety
> deliberately if there is a VERY good reason for it.

    Sorry, that was an aside that could be misleading.  I was referring
to a different issue:  The cases where the outer  procedure creates one
or more tasks.  These cases are somewhat harder to deal with because of
the rules about masters and when a scope is left.  For instance if you
move a task out of a procedure, so its entries are visible to other
(formerly nested) procedures, then you may have to add explicit code to
terminate the tasks at the right point in time.  This is why you may
want to instantiate a generic package inside the procedure to get the
right semantics without kludges.

    In the cases Robert Dewar is talking about, where tasking is not
dealt with in otherwise sharable code, you can often factor the tasking
out at a higher level.  I often wrap procedures this way:

  procedure Protected_Foo is begin Lock.Seize ; Foo; Lock.Release; end;
  -- add parmeters to taste.

  This provides both tasking and non-tasking safe versions.  It will
work correctly even if Foo is recursive.  The other way to deal with
potential tasking is to pass all shared data in one or more explicit
parameters.  This way the caller can do anything necessary at his
level.  The random number packages in Ada are a result of this type of
thinking.  Since they pass a generator object around, it is up to the
user in a tasking environment to decide which tasks should share
generators and how.


-- 

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1999-10-19  0:00 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7ttb4a$8mq$1@nnrp1.deja.com>
     [not found] ` <3802597B.9205AEE8@averstar.com>
1999-10-12  0:00   ` Self-referential types Ted Dennison
1999-10-12  0:00     ` Matthew Heaney
1999-10-13  0:00       ` Ted Dennison
1999-10-12  0:00 ` Robert A Duff
1999-10-12  0:00 ` Vladimir Olensky
1999-10-12  0:00   ` Matthew Heaney
1999-10-12  0:00     ` Ted Dennison
1999-10-12  0:00       ` Matthew Heaney
1999-10-12  0:00     ` Robert I. Eachus
1999-10-12  0:00       ` Matthew Heaney
1999-10-13  0:00         ` Ted Dennison
1999-10-13  0:00           ` Matthew Heaney
1999-10-13  0:00         ` Vladimir Olensky
1999-10-13  0:00           ` Vladimir Olensky
1999-10-18  0:00           ` Robert Dewar
1999-10-18  0:00             ` Vladimir Olensky
1999-10-18  0:00             ` Laurent Guerby
1999-10-13  0:00         ` Robert I. Eachus
1999-10-13  0:00           ` Brian Rogoff
1999-10-15  0:00             ` Robert I. Eachus
1999-10-15  0:00               ` Marin David Condic
1999-10-15  0:00                 ` Robert I. Eachus
1999-10-18  0:00                   ` Robert Dewar
1999-10-19  0:00                     ` Robert I. Eachus [this message]
1999-10-18  0:00               ` Robert Dewar
1999-10-18  0:00                 ` Ed Falis
1999-10-19  0:00                   ` Robert Dewar
1999-10-18  0:00                 ` Brian Rogoff
     [not found]               ` <7u86su$o5v$1@nntp8.atl.mindspring.net>
1999-10-18  0:00                 ` Robert I. Eachus
1999-10-22  0:00                   ` Richard D Riehle
1999-10-22  0:00                     ` Robert I. Eachus
     [not found]               ` <slrn80fl9f.68j.aidan@skinner.demon.co.uk>
1999-10-19  0:00                 ` Wes Groleau
1999-10-21  0:00                   ` Robert Dewar
1999-10-21  0:00                     ` Comments (was: Self-referential types) Wes Groleau
1999-10-21  0:00                       ` Ehud Lamm
1999-10-22  0:00                         ` Ted Dennison
1999-10-23  0:00                           ` Ehud Lamm
1999-10-23  0:00                         ` Robert Dewar
1999-10-23  0:00                           ` Ehud Lamm
1999-10-23  0:00                             ` Comments Georg Bauhaus
1999-10-24  0:00                               ` Comments Ehud Lamm
1999-10-26  0:00                                 ` Comments Robert I. Eachus
1999-10-28  0:00                                   ` Comments Jerry van Dijk
1999-10-28  0:00                                     ` Comments Ted Dennison
1999-10-25  0:00                             ` Comments (was: Self-referential types) Wes Groleau
1999-10-23  0:00                       ` M.
     [not found]                       ` <Pine.A41.3.96-heb-2.07.991021191504.30582K-100000@pluto.mscc.huji. <381477c9.e1388ff3@ftw.rsc.raytheon.com>
1999-10-25  0:00                         ` Larry Kilgallen
1999-10-21  0:00                     ` Self-referential types Larry Kilgallen
1999-10-21  0:00                     ` Jean-Pierre Rosen
1999-10-21  0:00                       ` Robert Dewar
1999-10-22  0:00                     ` Richard D Riehle
1999-10-23  0:00                       ` Robert A Duff
1999-10-23  0:00                         ` Richard D Riehle
1999-10-24  0:00                       ` Michel DELARCHE
1999-10-12  0:00     ` news.oxy.com
1999-10-12  0:00       ` Matthew Heaney
1999-10-12  0:00       ` Ted Dennison
1999-10-12  0:00         ` Stanley R. Allen
1999-10-13  0:00           ` Ted Dennison
1999-10-13  0:00         ` Vladimir Olensky
1999-10-14  0:00         ` Multiple Inheritance in Ada 95 [was Re: Self-referential types] Tucker Taft
1999-10-12  0:00     ` Self-referential types Richard D Riehle
replies disabled

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