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.
In reply to Re: Frustration with File Locking in Vista
by Corion
in thread Frustration with File Locking in Vista
by Mikey3883
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |