apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: apr_temp_dir_get()
Date Wed, 11 Apr 2007 13:49:08 GMT
Joe Orton wrote:
> On Mon, Apr 09, 2007 at 10:26:57AM -0400, Jim Jagielski wrote:
> > Hmmm... While looking over some proxy changes, for some
> > reason my eyes were pulled to apr_temp_dir_get(). Note
> > that the comments state:
> > 
> >     "Our goal is to find a temporary directory suitable for writing
> >      into.  We'll only pay the price once if we're successful -- we
> >      cache our successful find."
> > 
> > Except we don't (cache); neither in 0.9.x or trunk.
> > 
> > So is the comment broken or the code? Methinks the code,
> > but I'm sure one reason was due to potential thread
> > safety issues... ?
> The original apr_temp_dir_get() implementation did use a static variable 
> to cache the result, so that's probably what the comment refers to; but 
> as you suspect it wasn't thread safe so this was fixed.  (not sure if 
> the non-thread-safe-code even made it into a release)

The 0.9.x branch version still uses a static global, but
it still goes ahead and checks all the envars, dirs, etc
anyway. In other words, it doesn't check for that the
static global has been used or not, it just re-does the
whole check and then tucks it away...

Sounds like we need to update the comments...

   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
	    "If you can dodge a wrench, you can dodge a ball."

View raw message