discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting running application


From: Chris B. Vetter
Subject: Re: Detecting running application
Date: Thu, 11 May 2006 13:06:22 +0200

On 5/11/06, Richard Frith-Macdonald <richard@tiptree.demon.co.uk> wrote:
[...]
Assuming that you are only concerned about a single application ...

No. To ensure it's loaded only once in one single application wouldn't
be a problem, since I can check NSBundle-allBundles.

If you are concerned about multiple applications you really have a
problem ... you need to synchronize with bundle creation between apps.

Yes. A bundle can be loaded in (at least) three different ways:

1) An application can load it during startup using NSBundle-initWithPath:
2) GSAppKitUserBundles() can be set to load the bundle within the
2a) application's "domain" eg. Gorm = { GSAppKitUserBundles = (
/path/to/bundle ) }
2b) NSGlobalDomain

I simply want to make sure that, regardless of which of these three
cases is used, the bundle would be initialized only once.

I've just tried to use DO, but apparently this will introduce a racing
condition if two applications are started within just a few seconds,
eg. during log in.

I guess your apps could use [NSPortNameServer-registerPort:forName:]

The point is that in case (2) above, the applications wouldn't
necessarily be mine, so I have to do the check either in the bundle's
+initialize or -init ...

--
Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]