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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,534dd301375921ac X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.193.129 with SMTP id ho1mr2978340pbc.8.1339692498974; Thu, 14 Jun 2012 09:48:18 -0700 (PDT) Path: l9ni50460pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: Re: Is Text_IO.Put_Line() thread-safe? Date: Thu, 14 Jun 2012 07:42:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <93201f1a-d668-485e-83b4-492bc283f36e@googlegroups.com> NNTP-Posting-Host: 192.35.35.34 Mime-Version: 1.0 X-Trace: posting.google.com 1339685856 23989 127.0.0.1 (14 Jun 2012 14:57:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 14 Jun 2012 14:57:36 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.35.35.34; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-06-14T07:42:26-07:00 List-Id: On Thursday, June 14, 2012 9:49:45 AM UTC-4, Robert A Duff wrote: > awdorrin writes: >=20 > > Text_IO.Put_Line( Proc_Enum'Image(thisPID)&" waiting for "& Proc_Enum'I= mage(waitPID)); >=20 > Put_Line is not thread safe when called by multiple tasks > on the same file. The file here is standard output. Standard output > is a shared variable, so if you want to access it from multiple tasks, > you need to synchronize. =20 >=20 > - Bob I was afraid of that... I was hoping that there would be a way to set a fla= g to keep the task from switching in the middle of the Put_Line. Something like: CriticalSection.On; Text_IO.Put_Line("blah blah"); CriticalSection.Off; (Thinking back to Win32 C programming days...) I'm not that worried about the corruption in the Put_Line itself, what I'm = worried about is if the corruption will go both ways, meaning could it corr= upt the record array that is being sorted. (Like the text string being prin= ted ending up in the middle of a data record.)