discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Detecting running application


From: Richard Frith-Macdonald
Subject: Re: Detecting running application
Date: Thu, 11 May 2006 14:47:39 +0100


On 11 May 2006, at 14:24, Chris B. Vetter wrote:

On 5/11/06, Richard Frith-Macdonald <address@hidden> 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.

Oh sure ... I thought you meant using the DO name service code (as you mentioned using gdomap earlier) not just sending messages around.

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.

Absolutely not ... but I looked at the code for the NSMessagePortNamesSrver and noticed that it has a bug in handling the names ... it needs to ensure that any name it is given is a valid filename (not a path), but it isn't doing that. I'll write a fix to mangel paths into filenames. In the meantime you could, as a proof of concept, use the last path component of the bundle path rather than the full thing.

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.

Actually I would have thought it made sense to have it be an app/ daemon rather than a loadable bundle.

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.

Well, I *sort* of see ... but it looks to me like the sort of functionality you are describing would make more sense as apps or daemons or as functionality provided as services than in bundles. What about a simple background app built solely to run the bundles ... then you never need to worry about the bundles being loaded in multiple apps since there is only a single app loading them all.






reply via email to

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