[Gambas-user] How to avoid second instance?

Alberto Torres dithi at ...600...
Tue Sep 14 17:22:44 CEST 2004


Maybe using a lock file with the PID in it:

-Check if exists the lock file (say /tmp/yourapp.lock) and it has a 
number in it.
    -If so, check if the program with that PID is running (i.e. checking 
/proc/[pid], say pid is 12345, check if directory /proc/12345 exists)
       -If it is already running, exit
       -Else, replace the lock file writng Application.Id in it, and 
continue.

Regards
DiThi

Eilert escribió:

> Hi,
>
> how can I avoid that a second instance of the same prog is started e. 
> g. by a double click?
>
> Is there a way of finding out if there is another instance of the same 
> prog by the same user running? Or do you think a file-based solution 
> (lock files) is easier to implement?
>
> Rolf
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM. 
> Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>






More information about the User mailing list