Rajesh Nikam wrote:

Hi all,

We can maintain single instance of application on MS Windows by creating
event, mutex or semaphore.
If another instance is run, while creating above kernel object it will
succeed and return error as ERROR_ALREADY_EXISTS. So this is another
instance and can close down.

On Linux I tried of same by creating semaphore. But if application is killed
semaphore is not closed and not if I run application, semaphore already
exists and application can not start.

please throw some light on this issue .

Regards
Rajesh

--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      ([EMAIL PROTECTED])
List Information:  http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.





You could always have your app write out a .pid file containing it's own pid to /var/tmp
Then you can check for that file, and also check whether a process with that is is runnning (use /proc maybe)
If both exist, then your app already has an instance running, If only the file exists, then your app was killed, and you can start another


Cheers
James

--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      ([EMAIL PROTECTED])
List Information:  http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to