comp.lang.ada
 help / color / mirror / Atom feed
From: "fabio de francesco" <fmdf@tiscali.it>
Subject: Re: Ada.Text_IO and protected objects
Date: 2 May 2005 09:29:47 -0700
Date: 2005-05-02T09:29:47-07:00	[thread overview]
Message-ID: <1115051387.922324.105160@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <m23bt590r7.fsf@hugin.crs4.it>


Jacob Sparre Andersen wrote:
> Fabio de Francesco wrote:
>
> > Thank all of you. I have thought a while about the need to start a
> > third task to do the actual writing to Standard_Output as the
second
> > variant mentions. I decided not to do it because the original
> > problem is to manage two different printer devices or output files,
> > one at each door.
>
> If you write to two _different_ files in the two different tasks,
then
> you're safe, but that was not what you were doing.

Yes, indeed.

>
> > Otherwise there wouldn't be any need two have two different tasks
to
> > emit tickets, only one would suffice. (I hope I am not missing
> > something...)
>
> What the two tasks in youre examle are doing, is: logging that the
> protected object issues tickets to them - to a _common_ log.

You're correct: to a common log. That was only a test to acquaint
myself with tasks and protected types. My attention was to the
protected object behaviour and to the general structure of a program
with tasks.

Initially the program was raising contrained errors and many of you
helped to find the bugs in it. Those errors weren't related at all to
output, in fact now it works for doing what it has been designed.

At first I wasn't particularly interested to the output, that is it
doesn't mattered to get output lines ordered by increasing "ticket"
numbers. I was only interested at solving the immediate issue that
couldn't make the program run.

Only after someone explained that output could get out interleaved I
became to investigate this other issue. So in my latest post I asked
how you would do if it were needed that lines didn't get interleaved
when going to the same output channel. Just to know how to do it when
it is required.

> > Anyway just to reason on the solution Dmitry and Jacob suggest, how
> > would you implement that one? If I have understood there would be
> > the need for a third task in charge to handle IO. I suppose it
means
> > that the other two tasks have to emit "tickets" to a protected
queue
> > that would be later read by the third task in order to print
> > them. Is it what you mean? How can we assure that all elements in
> > queue are ordered by increasing numbers if any of the previous two
> > tasks add tickets to this queue at random times? I think there must
> > be something I didn't catch. I am not even sure you were proposing
a
> > queue working in terms I explained here. Can you make your solution
> > clearer for me, please?
>
> Your original specification (if one can say there was any) didn't say
> anything about having to log the issued tickets in sequence.  Please
> give us a more exact description of what you want to do, before we
> start making speculative experiments based on more or less wild
> guesses.

Yes, indeed. I hope I've made it clearer. That's it. Sorry for my
English.

Regards,

fabio de francesco




  reply	other threads:[~2005-05-02 16:29 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
2005-05-02 10:41                   ` fabio de francesco
2005-05-02 14:10                     ` Jacob Sparre Andersen
2005-05-02 16:29                       ` fabio de francesco [this message]
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