in reply to Frustration with File Locking in Vista
As Windows supports mandatory file locking, you can simply open the file for writing and do that with the FILE_FLAG_DELETE_ON_CLOSE flag, so when your process goes away so will the file. See Win32API::File for the nitty-gritty. Alternatively, you can try the same with a pipe/mailbox in //./PIPE/$0 and thus circumvent the need for a physical file.
Of course, when creating the file fails, you can assume that another instance of your process is already running.
|
|---|