httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Kasichainula <man...@io.com>
Subject Re: cvs commit: apache-apr/include apr_file_io.h
Date Mon, 12 Apr 1999 08:16:52 GMT
On Sun, Apr 11, 1999 at 07:14:55PM +1000, Brian Havard wrote:
> >Hmmm. This looks like it would require keeping thread-local data to
> >keep track of where we are in a directory, or we wouldn't be allowed
> >to share an ap_dir_t structure between threads.
> 
> You'd want to share a directory handle between threads? A regular unix
> readdir() wouldn't do that! Surely you'd do an opendir in each thread.

The actual opendir() call wouldn't be made until a thread requests an
iteration object like the one I described before. If there is a
platform that doesn't actually store a position in a DIR like object,
then we can make the opendir() call on that platform when we create
the ap_dir_t.

That way, if a platform lets you optimize your code by sharing the
DIR object, you're able to use that optimization in APR. If not, we
just do the opendir() call in each thread behind the scenes, and we
haven't lost anything anyway.

Now, I'm not claiming that this should be implemented in v1.0, but I
think it would be a cool thing to do eventually.

> >I really like the Java model for handling stuff like this. A directory
> >is a list of directory entries. So, you have functions that can dump a
> >whole list to an array.
> 
> Only problem there is that it's potentially wasteful to read the entire file
> list. It could consume a large amount of memory if there a lots of files and
> if you only use the first few entries, a lot of I/O as well.

Right. This function would only be used when you know that you're
going to use every entry (for example, when returning a directory
index to the client).

> Hmmm, that brings to mind another possible optimization. Some OS's allow
> filtering the file names returned. The interface could allow a filter to be
> specified which would either be passed to the OS function or implemented in
> the apr code where the OS doesn't support filtering.

This sounds cool. Ideas like this (and my idea above) have to be
judged with the idea of striking the right balance between simplicity
and support of cool OS features.

Now, we need to decide: is this work actually going to be called APR?

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
"Don't. You're too young to experience that much pain." -- Cmdr. Susan
  Ivanova, Babylon 5

Mime
View raw message