cvs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-dev] Re: new dirent module


From: Jim Hyslop
Subject: [Cvs-dev] Re: new dirent module
Date: Wed, 12 Jul 2006 10:45:35 -0400
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Derek R. Price wrote:
> Hey Jim,
> 
> Do you know if there is any good reason why I shouldn't rip out most of
> the contrived directory cache in dirent.c and just save hFile in the DIR
> *, then only call _find_first() from opendir(), _find_next() from
> readdir(), and _find_close() from closedir()?

I'm not extremely familiar with the _find functions, but on a quick look
I don't see any problems. The MSDN implies that they are at least
reentrant, if not thread safe: "The _find functions allow nested calls."

> It seems to me that this would save a lot of overhead, so I'm not quite
> sure why it wasn't done this way in the first place.  Are there race
> conditions involved if the directory changes while it is being read by
> the _find* functions?

No more than what would currently happen, as far as I can tell. I just
stepped through the test program provided by the MSDN, which basically
iterates through all *.c files in the current directory and prints out
basic information. After the call to _findnext, I deleted two of the
files, and the program kept going happily. _findfirst appears to take a
snapshot of the directory, just as opendir does.

- --
Jim Hyslop
Dreampossible: Better software. Simply.     http://www.dreampossible.ca
                 Consulting * Mentoring * Training in
    C/C++ * OOD * SW Development & Practices * Version Management
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEtQsPLdDyDwyJw+MRAuMPAKCWe9+LX+ZztaNd6QYqs6zstAmWpgCg3yxi
R71QfqCu+DWPTvAjDWC1jbE=
=Tai9
-----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]