Re: A problem about programming with gtk+ in multiprocess.



On Sun, 16 Dec 2001 11:45:41 EST, Paul Davis said:

> we need to make it more clear that after fork(2), the child should never
> access GTK structures or functions unless the parent never does so
> again. can we add something to the FAQ about this?

What you *need* to do is as follows:

1) Have a internal variable in gtk  gtk_mypid.

2)  In gtk_init()  add 'gtk_mypid = getpid();'

3) In all the other gtk functions add:

    if (gtk_mypid != getpid()) {
       perror("You idiot, this doesnt' work after a fork()");
       exit(1);
    }

Of course, you want your own version of perror() that delivers the message
with a baseball bat. ;)

-- 
				Valdis Kletnieks
				Operating Systems Analyst
				Virginia Tech

Attachment: pgp4y4NuVAcx5.pgp
Description: PGP signature



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