fork in callbacks



Rodrigo Moya writes:
 > Can I fork() inside a (GNOME) widget callback?, for example:

Think very carefully about whether you really want to do this.

It will create two copies of every widget in your program. If any
of your widgets are associated with X resources like windows then
you will have two separate processes trying to access the same 
resources. Furthermore, the child copy will not have an X connection!

This is not a problem providing you "throw away" the child process by 
doing an execve (or similar) shortly after forking. However, the 
gnome-libs already provide you with an API for starting an executable 
(libgnome/gnome-exec.h) and one for starting a CORBA server
(libgnorba) so there may be no need to fork for yourself.

Felix



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