I'm not quite sure what while I do all of the reading/writing I need to do meansWhat I ment was that I need to do more than just read or just write the file, I need to be able to read the file, make changes, then write back. If I lock the conventional way, then I'll open a file handle for read, lock it, release the handle, open a handle for write, lock it, then release the handle. There is a period of time between my two locks where the file could be changed. That means the version of the file in memory would be different then the one on disk (the version in memory would be older).
If I make changes to the version in memory then write out to disk, I'll clobber changes made to the file after I read it into memory. So I need a lock that will let me have exclusive access to the file until I'm done with it.