One cross platform technique but flawed in some contexes.
Create a file with the PID of the program.
1. check if this file exists.
If it does, check the PID, is it running or not? If it is running, close the new application.
If for some reason the file didn't get erased, the PID will most likely not be running (a flaw) and the file can be updated with the new PID.
2. When the program starts, write the PID to a file.
3. When the program exits, remove that file.
Or set an environment variable.




Reply With Quote


Bookmarks