Linux File Locking Mechanism
I have a situation where the one process 1 is writing files on Linux server and process 2 is polling for newly created files and reads them , making a copy and passes to another process.
Now, I want to know that is it possible that process 2 can read a file before the process 1 completely write it. Is there any kind of automatic kinda locking mechanism in Linux which stops process 2 to read the file before process 1 completely write it.
Any kind of help will be appreciable.