comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: Stream venting (long)
Date: 1998/12/29
Date: 1998-12-29T00:00:00+00:00	[thread overview]
Message-ID: <76aor7$l4q$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 769g3r$moq$1@nnrp1.dejanews.com

In article <769g3r$moq$1@nnrp1.dejanews.com>,
  robert_dewar@my-dejanews.com wrote:
> In article <768sng$6r9$1@nnrp1.dejanews.com>,
>   dennison@telepath.com wrote:
> >   1. Stream 'Writes and 'Reads are inherently task
> >      unsafe. Possible solution 1a: You can of course try
> >      to implement your stream in a
> >      task safe manner. But as a stream implementor all
> >      you will see is a series of
> >      Write calls. A single 'Write from the client will
> >      cause an indeterminate number of these. There's no
> >      way to tell if a Write or Read call is the first
> >      or last in a series. If you need to make the enitre
> >      composite type's 'Write or 'Read atomic, you're SOL.
>
> I find this complaint bizarre, I must not understand it
> properly.
>
> First, the idea of different tasks writing asynchronously
> to a common stream seems an entirely bizarre program
> organization.

The bizarre program orginization you refer to is commonly called "logging".
It is also a good way to implement checkpointing or persistent objects,
unless you really *want* one file per task. Hmmm...Now I guess in my
particular situation I could use one file per task...perhaps that's the
solution.

> Second, if you really *do* want such an organization, it
> seems quite easy to program stream functions so that they
> are properly atomic. I see no difficulty in doing this.
> You just need a single lock, with a test that avoids
> messing with it if it is already set.

The problem is when to release the lock. You can't acquire and release it
after every call to the stream's Read or Write procedures, or you get
interleaved data. You'd have to do it *manually* before the client's first
top level 'Write call and after their last. That means the client has to do
it. Yuk.

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-12-29  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-28  0:00 Stream venting (long) dennison
1998-12-29  0:00 ` robert_dewar
1998-12-29  0:00   ` dennison [this message]
1998-12-29  0:00     ` robert_dewar
1998-12-30  0:00       ` dennison
1998-12-30  0:00         ` robert_dewar
1998-12-30  0:00           ` dennison
1998-12-31  0:00             ` robert_dewar
1998-12-31  0:00               ` LeakyStain
1998-12-31  0:00                 ` dewar
1998-12-31  0:00                   ` dennison
replies disabled

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