httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: bucket siblings / thread safety
Date Thu, 03 May 2001 01:27:26 GMT
On Tue, May 01, 2001 at 03:41:50PM -0500, William A. Rowe, Jr. wrote:
> From: "Bill Stoddard" <bill@wstoddard.com>
> Sent: Tuesday, May 01, 2001 11:56 AM
> 
> > Why can't we just cache the open file descriptor (not apr_file_t, 
> > but the actual descriptor) then build a bucket out of the request 
> > pool (just as if we opend the file as part of the request
> > processing)?
> 
> What file descriptor?  This is the wrong way to go, IMHO.  We invented
> apr_file_t's for a reason.  Provide a way to 'realloc/copy' an apr_t
> entity into another pool (different lifetime) portably, don't go assuming
> stuff.  On win32, we MUST know if the file handle was opened normally,
> or for overlapped IO (no current file position) access.

We already have it. It's called apr_file_dup().

Keep the apr_file_t open and in the cache. When you want to deliver it, do
the following:

  status = apr_file_dup(&new_file, cached_file, r->pool);
  bucket = apr_bucket_file_create(new_file);
  ...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message