A quick and dirty cross-platform solution would be to create a 'lock' file at startup and delete the file at shutdown. Any new instances check if the file exists first before continuing.
This isn't foolproof, since if your app crashes, you will have to delete the file manually.
Bookmarks