In my project a a process is creating a file and different process of other software reading that file.As file is created the other process reads it even the size of file is 0.I want to implement the locking mechanism on file for linux because filechannel lock is working in windows but not in Linux.So please suggest me the solution.
Asked
Active
Viewed 37 times
0
-
You can create a MyAppLockfile on ~/tmp/ while your process build the file. If it finish the creation operation you have to remove the lockfile On your process that read that file, you have to verify the lockfile's existence. If it exists, your file creator process still building the file. If the lockfile not exists, it means that your file is ready. – Carlos Porta Aug 27 '15 at 03:46
-
Define 'not working in Linux' Are you aware that Linux file locks are advisory only by default, and only affect other programs using locks? – user207421 Aug 27 '15 at 04:53