comp.lang.ada
 help / color / mirror / Atom feed
From: sampson@cod.NOSC.MIL (Charles H. Sampson)
Subject: Re: LRM question - access types and con
Date: 29 Jun 90 21:55:31 GMT	[thread overview]
Message-ID: <1983@cod.NOSC.MIL> (raw)
In-Reply-To: 12142@encore.Encore.COM

In article <12142@encore.Encore.COM> jcallen@encore.com (Jerry Callen) writes:
>
>So what about the built-in I/O packages? Is it safe for multiple tasks
>to be issuing, say, Put_Line calls without worrying about synchronization?
>
     My answer is a variant of my followup to the original question:  A pro-
grammer doesn't have to worry about synchronizing calls to the I/O procedures
provided no pair of tasks is operating on the same file; otherwise the imple-
mentation will not satisfy the semantics of the LRM ("Put_line calls the
procedure Put for the given string ...").

     If two tasks are accessing a common file, then all bets are off.  The
file becomes a shared resource and synchronization is definitely the program-
mer's responsibility.  In the case of text I/O, Put_line is defined, ulti-
mately, in terms of repeated calls on Put for single characters.  With this
definition, interlacing of strings is almost guaranteed.

     Should the definition be changed?  It's not easy because there is no
obvious useful way to synchronize the tasks.  Guaranteeing private access
to the file during output of words, sentences, lines, and paragraphs are
all clearly inadequate.  (How often is a report with alternate paragraphs
coming from two different sources useful?)

                              Charlie Sampson

  reply	other threads:[~1990-06-29 21:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1394@software.software.org>
1990-06-27 15:53 ` LRM question - access types and con stt
1990-06-28 13:34   ` Jerry Callen
1990-06-29 21:55     ` Charles H. Sampson [this message]
1990-06-29  3:51   ` Michael Feldman
1990-06-29 13:25     ` Vinod Grover
1990-06-29 17:30       ` Michael Feldman
replies disabled

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