apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: apr_file_close bug?
Date Mon, 01 Oct 2001 22:19:57 GMT
On Mon, Oct 01, 2001 at 01:36:18PM -0500, William A. Rowe, Jr. wrote:
> From: "Cliff Woolley" <cliffwoolley@yahoo.com>
> Sent: Monday, October 01, 2001 1:32 PM
> 
> 
> > I think it should just say this:
> > 
> > {
> >     apr_pool_cleanup_kill(file->cntxt, file, apr_unix_file_cleanup);
> >     return apr_unix_file_cleanup(file);
> > }
> > 
> > Which is exactly equivalent to what apr_dir_close() does now that it's
> > been fixed.  Thoughts?
> 
> Thinking ... yes.
> 
> Clear, concise, and less redundant.


Umm... no. Use apr_pool_cleanup_run(). That will run *and* remove the
cleanup in one fell swoop. So your code is even simpler:

  return apr_pool_cleanup_run(file->cntxt, file, apr_unix_file_cleanup);


You could even see this as an "atomic" run-remove call.

Cheers,
-g

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

Mime
View raw message