comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada.Text_IO and protected objects
Date: Sat, 30 Apr 2005 12:21:34 +0200
Date: 2005-04-30T12:21:28+02:00	[thread overview]
Message-ID: <1s8wkzten2pnf.p7sbzkiszqsd.dlg@40tude.net> (raw)
In-Reply-To: m2mzrg3a51.fsf_-_@hugin.crs4.it

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



  reply	other threads:[~2005-04-30 10:21 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               ` Ada.Text_IO and protected objects Jacob Sparre Andersen
2005-04-30 10:21                 ` Dmitry A. Kazakov [this message]
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