On 23 Jan 2006, at 08:50, Roman Belenov wrote:

I hacked a bit trying to implement logoff with graceful application
termination on GNUstep and got some questions:

1) How to get a list of all running GNUstep applications ?
launchedApplications seems to return only the list of apps launched from the current one. For now I just use a list of message ports obtained by examining corresponding subdirectory and treat everythying as a proxy for application.

Well, the way workspace operations generally *should* work as I understand it, is that they should contact the workspace manager application and ask it to do the job for them. There is partial support for this in the NSWorkspace class, but it has never been completed. Basically, the idea is that the local NSWorkspace instance should first try to ask the workspace manager application to do jobs, and if no application is found, it should do the best it can. In the case of launched tasks, this means that every application keeps track of any tasks it sees being launched, but since there is no workspace application launching all tasks, there is no central repository of all the information.
So, what you should ideally be doing is fixing that ...
Problem is that it was never completed because to make it useful there needs to be a workspace manager application and when I wrote it no such application existed. Then later Enrico wrote GWorkspace without much attention to integration with the NSWorkspace class, and we never got together to make it all work.

2) What is the correct way to check the result of sending terminate to
application (from another one) ? Experiments show that if application actually
terminates, I get an exception caused by connection timeout.

Yes .. you expect the connection to go away when the app terminates. I don't think there is any realistic way you can be absolutely sure an app has completely gone away (though you could try registering a port using the name of the task ... if it works then the app has gone ... if it fails either the app is still running or another app with the same name has started). It's probably best to just assume that loss of the connection to the app means that it has died. Of course, in the case of the workspace manager application (which should generally have launched the app and be responsible for shutting it down too), you have an NSTask object corresponding to the launched application, so you can check the NSTask instance to see if the application is still running after it has been told to terminate.



_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to