[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [DESIGN] Stacked resources ownership model?

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2005-12-15 23:03:02 CET

On 12/15/05, Julian Foad <julianfoad@btopenworld.com> wrote:
> Erik Huelsmann wrote:
> >
> > * Create a special stream which breaks the ownership model by intent,
> > which can be used to interject between any stacked streams and
> > non-owned streams
>
> By a "non-owned stream" do you mean a stream that you wish wouldn't own its
> file (or other lower-level resource) though it actually does? Something like a
> stream-from-apr-file that does own and close its file (in the new ownership
> model), but where the insertion of this special "breaking" stream effectively
> causes the resulting stack of streams not to own the file?

With non-owned, I mean that the stream-pointer is a borrowed
reference: a caller passes a pointer to a stream object, but expects
the callee to do nothing more with it than read or write, especially
*not* close.

> I don't see how that can work. When I close this special stream, will it close
> the underlying stream_from_apr_file? If it does, that defeats the purpose
> because then the file will be closed; if it doesn't, that's wrong because the
> underlying stream won't be flushed and closed.

The latter is exactly the situation I want: the caller will flush and
close the stream when we return from the call.

> What am I missing?

The fact that if the callee closes the stream, it'll be closed twice?

HTH,

Erik.
Received on Thu Dec 15 23:09:29 2005

This is an archived mail posted to the Subversion Dev mailing list.