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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c3c4ae45442f569e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada.Text_IO and protected objects Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1114747457.868019.93210@f14g2000cwb.googlegroups.com> <42720DCD.6030304@mailinator.com> <4272260d$0$30463$ba620e4c@news.skynet.be> <1114811841.250745.71870@o13g2000cwo.googlegroups.com> Date: Sat, 30 Apr 2005 12:21:34 +0200 Message-ID: <1s8wkzten2pnf.p7sbzkiszqsd.dlg@40tude.net> NNTP-Posting-Date: 30 Apr 2005 12:21:28 MEST NNTP-Posting-Host: b5df2c5d.newsread4.arcor-online.net X-Trace: DXC=`5ij2K5H@@=E][lTbkER26:ejgIfPPld4jW\KbG]kaM8liQbn6H@_E9^[gJemfNOh6[6LHn;2LCV>COgUkn_?_Y?WiRECcWkSV7 X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10852 Date: 2005-04-30T12:21:28+02:00 List-Id: On 30 Apr 2005 11:07:54 +0200, Jacob Sparre Andersen wrote: > I am not sure if the appropriate way of handling access to > Standard_Output is by using a protected object to manage a queue for > transferring data to the task doing the actual writing to > Standard_Output, or if the interaction should be through a direct > rendezvous with the task doing the actual writing to Standard_Output. #3: It can be also done on the context of the same task using a protected object implementing a mutex. A controlled object is then used for safe mutex access. But a monitor task (the second variant you mention) is cleaner and safer in my view. It might be slightly slower than mutexes, though that should depend on the compiler-platform. > There is a "dining philosophers" example available somewhere on the > web (written by Feldman, I think), where you probably can find a good > example of how to solve the combination of tasking and IO. Dining philosophers is rather an example of why mutexes/semaphores are dangerous (deadlock) and low-level and what could be done about that. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de