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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,63360011f8addace X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-16 14:29:49 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: gnat: time-slicing Date: 16 Jul 2002 14:29:48 -0700 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0207161329.5c8e387b@posting.google.com> References: NNTP-Posting-Host: 212.157.227.203 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1026854989 26550 127.0.0.1 (16 Jul 2002 21:29:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Jul 2002 21:29:49 GMT Xref: archiver1.google.com comp.lang.ada:27165 Date: 2002-07-16T21:29:49+00:00 List-Id: Jan Prazak wrote in message news:... > Hello, > > I have seen this example program in a tutorial: > > ------------ > with Ada.Text_IO; use Ada.Text_IO; > > procedure Task_Demo is > task A; > task body A is > begin > Put_Line("b"); > Put_Line("b"); > end A; > begin > Put_Line("a"); > Put_Line("a"); > end Task_Demo; This is a nonsense example, it is erroneous to do output on the same file from two different tasks, since obviously the file is a shared variable, and the program violates rules about access to shared variables. You must always properly control access of tasks to I/O. If the compiler deleted your hard disk when you ran this program, you could decide that it was an unpleasant compiler to use, but not that it was an incorrect compiler (erroneous programs have completely undefined semantics). All the discussion about time slicing is besides the point given this observation.