Getting PIDs which have files open / waiting for file write to complete
I have a program that waits for new files in a directory. As soon as a new file is created, my program begins reading and processing it. Apparently, this reading can occur even as the file is being written, and may end before the write process is completed. Ideally, what I'd like to do is wait until the write is complete. I've tried opening the file for write access, which I assumed would wait until the other writing process closed the file, but that doesn't seem to be the case. Can this be done? Or, is there an easy way to figure out if someone (a process) has a file open for write access?
|