in reply to Re^2: Abort if instance already running?
in thread Abort if instance already running?
just remember to clean up if "bad things" happen to your program and the normal "release lock" code doesn't execute.Needlessly complicated! I never work on an OS where a process that no longer exists continues to hold a lock on a file. On any Unix system I know of, if a program exits (be it normally, with a signal or by an error), all locks are released.
You may need an explicit release of the lock if your program forks or execs, and you don't want the children or the new program to hold the lock.
|
|---|