From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!nosc!cod!sampson From: sampson@cod.NOSC.MIL (Charles H. Sampson) Newsgroups: comp.lang.ada Subject: Re: LRM question - access types and con Message-ID: <1983@cod.NOSC.MIL> Date: 29 Jun 90 21:55:31 GMT References: <1394@software.software.org> <20600054@inmet> <12142@encore.Encore.COM> Reply-To: sampson@cod.nosc.mil.UUCP (Charles H. Sampson) Organization: Computer Sciences Corporation X-Local-Date: 29 Jun 90 14:55:31 PDT List-Id: 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