Re: Detecting multiple application instances
- From: "Daniel Solaz" <dsolaz sistelcom com>
- To: gtk-list redhat com
- Subject: Re: Detecting multiple application instances
- Date: Thu, 19 Aug 1999 14:14:27 +0200
Geert Bevin wrote:
>I could setup up a server which does all the command actions and holds
>all the shared data, but I'd like it to be a small, one executable, easy
>to install filemanager.
Use a lock file somewhere in the users home directory. Put the PID
inside so other instances can check with kill() whether the lock is held
by an existing process or has been left behind. Check the lock at the
beginning of your program: open() can be used to atomically
test-or-create the lock file. Destroy the lock you hold at exit.
This is what netscape's communicator does. I've done it in some
programs and works fine. I can email some code if you want.
-Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]