comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Ada.Text_IO and protected objects
Date: 30 Apr 2005 11:07:54 +0200
Date: 2005-04-30T11:07:54+02:00	[thread overview]
Message-ID: <m2mzrg3a51.fsf_-_@hugin.crs4.it> (raw)
In-Reply-To: 1114811841.250745.71870@o13g2000cwo.googlegroups.com

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 :-)"



  reply	other threads:[~2005-04-30  9:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-29  4:04 [newbie question] tasks and protected types fabio de francesco
2005-04-29  7:25 ` tmoran
2005-04-29  9:43 ` Jacob Sparre Andersen
2005-04-29 10:34   ` Alex R. Mosteo
2005-04-29 11:23     ` Jacob Sparre Andersen
2005-04-29 12:18       ` Adrien Plisson
2005-04-29 12:45         ` Ada.Text_IO and protected objects (Was: [newbie question] tasks and protected types) Jacob Sparre Andersen
2005-04-29 13:22           ` Poul-Erik Andreasen
2005-04-29 14:26           ` Egil H. H�vik
2005-04-29 20:28             ` Jacob Sparre Andersen
2005-04-29 20:39             ` Randy Brukardt
2005-04-29 21:23               ` Lionel Draghi
2005-04-29 22:11                 ` fabio de francesco
2005-04-30  3:45                   ` Jeffrey Carter
2005-04-30  7:21                   ` Lionel Draghi
2005-05-02  8:11                 ` Jean-Pierre Rosen
2005-04-30 12:47               ` Ada.Text_IO and protected objects Stephen Leake
2005-04-29 21:57             ` Ada.Text_IO and protected objects (Was: [newbie question] tasks and protected types) fabio de francesco
2005-04-30  9:07               ` Jacob Sparre Andersen [this message]
2005-04-30 10:21                 ` Ada.Text_IO and protected objects Dmitry A. Kazakov
2005-05-02 10:41                   ` fabio de francesco
2005-05-02 14:10                     ` Jacob Sparre Andersen
2005-05-02 16:29                       ` fabio de francesco
2005-04-29 15:23           ` Ada.Text_IO and protected objects (Was: [newbie question] tasks and protected types) Björn Lundin
2005-04-29 12:54       ` [newbie question] tasks and protected types Alex R. Mosteo
2005-04-29 10:47   ` fabio de francesco
2005-04-29 11:33     ` Jacob Sparre Andersen
2005-04-29 12:55       ` Alex R. Mosteo
2005-04-29 14:06         ` Egil H. H�vik
2005-04-29 14:12           ` Egil H. H�vik
2005-04-29 16:23             ` Robert A Duff
2005-04-29 20:19           ` Jacob Sparre Andersen
2005-04-30 11:58           ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox