Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSRunningApplication.h: "Not all applications have a pid"

Tags:

unix

cocoa

pid

From the comment on processIdentifier in NSRunningApplication.h:

Not all applications have a pid.

Huh?

I can see this happening in the specific case of an NSRunningApplication representing a terminated process (runningProcess.terminated == YES), but I can't think of an example of an running application NOT having a process ID. That's kinda Unix 101.

Documentation bug or am I missing something?

like image 619
rentzsch Avatar asked Mar 24 '11 05:03

rentzsch


1 Answers

It's a hedge. A "running application" is something that the user thinks of as an application. Shows up in the cmd-tab switcher, etc. That need not necessarily correspond directly to a process. In the classic environment, multiple applications were hosted by a single unix process, classic. In this situation NSRunningApplication would return -1 for each "application".

People who had been at it long enough had seen enough interesting hacks that they thought this was an important thing to define.

like image 61
Ken Avatar answered Nov 15 '22 20:11

Ken