[PATCH] Allow forced new processes for KUniqueApplication

Robert Knight robertknight at gmail.com
Sun Mar 23 18:18:50 GMT 2008


Hi,

> The two together seem... odd. How can you not fork and yet force a new 
> process? :-)

I think the name ForceNewProcess is misleading.  What I really mean is 
"don't re-use an existing instance of this application" which is done
by using a process-specific name when registering with the DBus server.

The sequence of events when starting two instances with just ForceNewProcess
would be:

(Process 0) KUniqueApplication::start()  (forks => Process 1)
(Process 1) KUniqueApplication::newInstance()
(Process 0 Exits)
(Process 2) KUniqueApplication::start()  (forks => Process 3)
(Process 2 Exits)
(Process 3) KUniqueApplication::newInstance() 

With ForceNewProcess | DoNotFork:

(Process 0) KUniqueApplication::start()  
(Process 0) KUniqueApplication::newInstance()
(Process 1) KUniqueApplication::start()  
(Process 1) KUniqueApplication::newInstance() 

With no flags:

(Process 0) KUniqueApplication::start()  
(Process 0) KUniqueApplication::newInstance()
(Process 1) KUniqueApplication::start()  
(Process 0) KUniqueApplication::newInstance() 

Regards,
Robert.

On Sun, 2008-03-23 at 18:56 +0100, Thiago Macieira wrote:
> Robert Knight wrote:
> >StartFlags {
> >        ForceNewProcess = 0x1 ,
> >        DoNotFork = 0x2
> >}  
> 
> The two together seem... odd. How can you not fork and yet force a new 
> process? :-)
> 
> Anyways, I'd suggest the multiple instances approach. How about 
> AllowMultipleInstances, thus matching the config?
> 





More information about the kde-core-devel mailing list