Re: [gtk-list] Re: Detecting multiple application instances
- From: Geert Bevin <gbevin thunderstorms org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Detecting multiple application instances
- Date: Thu, 19 Aug 1999 20:16:57 +0200
> >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.
I know it'd be possible to do this, but the problem comes with gnome
sessions. Apparently, the gnome session manager support multiple
sessions for the same user on the same machine. Putting the lock file
(or fifo, I prefer this, since it allows two ways communication) in the
homedir prevents a second (or third or ...) session from launching a new
instance of the app. I can't however find a way to uniquely identify a
gnome session by an id or somthing (only session client ids are
apparently available).
G.
--
Geert Bevin - gbevin@thunderstorms.org
Montenegrostraat 11 1060 Brussels
BELGIUM 0477/302.599
--------------------------------------
>> Idealists have to communicate <<
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]