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 15:24:07 +0200

On 5/11/06, Richard Frith-Macdonald <richard@tiptree.demon.co.uk> wrote:
[...]
> 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.
Not sure what you mean ... one (and only one) of the applications
should be able to register with a particular name.  If that's not the
case, then DO name serving is thoroughly broken ... so I suspect any
problem is with the logic in your code.  If not, there is a bug we
need to fix in the nameserver code.

I was experimenting by simply sending notifications back and forth
between bundle A and bundle B. That would introduce a racing
condition, as sending a message from A back to B might be delayed, so
B would finish the initialization even though A was already loaded.

Next, as suggested, I tried to use NSMessagePorts and
NSPortNameServer. However, -registerPort:forName: seems to completely
ignore the given name, instead looks like it always uses the
application's name to register the port. So A would register a port
with -bundlePath as name, but B isn't able to "see" that because
[[NSPortNameServer systemDefaultPortNameServer] portForName:
bundlePath] always returns nil.

If the application is not yours, then obviously any solution in which
you code a category to override -initWithPath: will not work since
other applications won't contain the category.  In fact I don't think
there is any possible *general purpose* solution unless it's built
into the gnustep libraries, and adding such a thing there seems
perverse because I can't immediately see what use it would be to
people generally.

It's too special to be added to GNUstep. But the question remains why
I can launch any application twice and won't be notified that it's
already running -- as it used to be.

That could be my failing ... I still don't see what you actually want
to achieve and why.
Probably a special case solution is fine ... but I don't know what
special case we are looking at...

As an example, imagine a bundle that would scan a folder for
images/pictures and display each as your desktop background
successively.

Now it wouldn't make sense to load such a bundle more than once, would it?
Probably, you would have it loaded with the first application you start.

I think I'm clear now that you only want one application to be able
to load bundles , but is that one application per user, one per host,
one per lan?

Per user, see above.

Why is it important that only one application is able to load these
bundles?
[...]

It's just one bundle and see above. Multiple instances just wouldn't
make sense in this example, plus they would consume a lot of memory
and generally bog down your box.

And no, I'm not working on this specific idea.

--
Chris




reply via email to

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