We must use _exit after fork



	Hi all,
I'm reading Gtk+FAG, it's really instructive :)
Here is the interesting part

5.3. Why does this strange 'x io error' occur when I fork() in my GTK+ app?
Why does this strange 'x io error' occur when I fork() in my GTK+ app?

This is not really a GTK+ problem, and the problem is not related to fork()
either. If the 'x io error' occurs then you probably use the exit()
function in order to exit from the child process.

When GDK opens an X display, it creates a socket file descriptor. When you
use the exit() function, you implicitly close all the open file
descriptors, and the underlying X library really doesn't like this.

The right function to use here is _exit().

You also have a example program.

Bye
Manu




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