Is there a standard Linux library for "lock files"? -
suppose have folder , want 1 instance of application working on @ time. can synchronize via filesystem itself. times accomplished .lock_file
if that's present know instance using it. there standard libraries handle sort of thing?
if using c/c++, see fclnt or flock : locking files in linux c/c++
if using java, see filechannel lock method , how can lock file using java (if possible)
you can check existence of .lock_file
opening open(pathname, o_creat | o_excl, 0644)
, see open man page, creates , opens file , returns eexist if pathname exists.
in java, calling file method createnewfile() can use create atomically .lock_file
Comments
Post a Comment