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,c3c4ae45442f569e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!news.banetele.no!news.hacking.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Ada.Text_IO and protected objects Date: 30 Apr 2005 11:07:54 +0200 Organization: hacking.dk - Doing fun stuff with open source Sender: sparre@hugin.crs4.it Message-ID: References: <1114747457.868019.93210@f14g2000cwb.googlegroups.com> <42720DCD.6030304@mailinator.com> <4272260d$0$30463$ba620e4c@news.skynet.be> <1114811841.250745.71870@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 80.241.165.38 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: xyzzy.adsl.dk 1114852338 26961 80.241.165.38 (30 Apr 2005 09:12:18 GMT) X-Complaints-To: usenet@news.hacking.dk NNTP-Posting-Date: Sat, 30 Apr 2005 09:12:18 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Xref: g2news1.google.com comp.lang.ada:10848 Date: 2005-04-30T11:07:54+02:00 List-Id: Fabio de Francesco wrote: > Thank you all for every insight on the subject. Anyway I don't yet > understand whether you mean that potentially "blocking" subprograms > should be put in a protected object or inversely they shouldn't. "Potentially blocking" subprograms should not be called from procedures, functions and entries of protected objects ("protected actions"). > In this thread I've been suggested to put the IO in a protected > object. Is it needed to do so? It is wrong to do so. - I apologise for the misleading advise. IO has to be done from a task (optionally the main task), not from inside a protected action. 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. 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. > What do you mean by "blocking"? I suppose you mean that OS can put > that process in a wait queue and switch to a new one, may be because > the first is waiting for some event like device IO. Is it correct? I think that is correct, but hopefully somebody more experienced in tasking will answer the question. Ciao, Jacob -- "If you think Tuck has said something that is completely wrong, you are almost certainly missing something :-)"