Re: Only one loaded executable...How ?
Re: Only one loaded executable...How ?
- Subject: Re: Only one loaded executable...How ?
- From: David Remahl <email@hidden>
- Date: Wed, 22 Jan 2003 21:45:24 +0100
You could use distributed objects to set up a shared object when the
tool launches. On subsequent launches you would look for that object
and quit if it exists, returning error. I have a feeling that would be
lighter than using Rendezvous. Other IPC facilities are also at your
service, of course.
A third alternative is to create a lock file / pid file to indicate
that the program is already started. Make sure you handle the situation
if the daemon is terminated prematurely, though (perhaps by checking
that the pid really is current).
/ Regards, David Remahl
I'm trying to find a elegant way to avoid the possibility
to launch my foundation application (no GUI) more than once.
1- My application provides NSNetServices. I could add a
NSNetServiceBrowser
before, that detects if this service is already available on the local
host. If yes, i'll
call exit(0).
2- I could use NSTask associates with some functions such as ps ....
But what is
happening if the executable is renamed ?
More ideas ?
Thx for you comments and your help.
K.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.