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-Thread: 103376,534dd301375921ac X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.220.230 with SMTP id pz6mr648131pbc.3.1340306876673; Thu, 21 Jun 2012 12:27:56 -0700 (PDT) MIME-Version: 1.0 Path: l9ni4231pbj.0!nntp.google.com!news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!78.46.240.70.MISMATCH!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Is Text_IO.Put_Line() thread-safe? Date: Thu, 21 Jun 2012 14:27:52 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <93201f1a-d668-485e-83b4-492bc283f36e@googlegroups.com> <3fff1269-06f5-47a2-bc10-c2145b3a297d@googlegroups.com> <17b8mcqy4f63k$.1jwvmc6qjjvnq$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1340306875 10025 69.95.181.76 (21 Jun 2012 19:27:55 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 21 Jun 2012 19:27:55 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Date: 2012-06-21T14:27:52-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:17b8mcqy4f63k$.1jwvmc6qjjvnq$.dlg@40tude.net... ... > IMO, queues should only be used for asynchronous scenarios. You're right, but shared I/O is (almost) always asynchronous. That is, queue up a debug log entry, output it whenever, but don't block the caller for a log entry (you still have to process incoming mail/web requests/whatever no matter how clogged the logger is). Synchronous shared I/O shouldn't be mixed with tasks, because it completely defeats the purpose of using tasks in the first place. The I/O serializes the tasks, and you now just have a very complex sequential program; you might as well have written a simple sequential program without the tasks. I generally use one task per I/O channel if the purpose of the task involves I/O, then no extra task safety is required (and, as noted, logging is asynchronous). Randy.