Re: fork/exec of X11 application.
Re: fork/exec of X11 application.
- Subject: Re: fork/exec of X11 application.
- From: Harald Hanche-Olsen <email@hidden>
- Date: Thu, 27 Mar 2008 02:20:36 +0100 (CET)
+ Robert Tillyard <email@hidden>:
> I have an X11 application that has been running for years on other
> UNIX platforms but when compiled on 10.5.2 I'm getting the following
> errors:
>
> $ The process has forked and you cannot use this CoreFoundation
> functionality safely. You MUST exec().
> [...]
>
> In my called program I use fork() twice [...]
>
> The above errors happen on calling XOpenDisplay().
>
> Apart from rewriting parts of my application can I cure this error?
I have no idea. But I note that the prohibition against using
CoreFoundation after a fork is mentioned near the end of this page:
http://developer.apple.com/releasenotes/CoreFoundation/CoreFoundation.html
Now, I am not at all sure why you have to fork your called program
twice. It should be enough for the parent just to continue without a
waitpid()? You could equip the parent with a SIGCHLD handler to reap
the child if and when it exits.
If you really must sever the parent-child relationship via a double
fork, another way to do it is to run a tiny wrapper that just forks
twice before the grandchild execs the program you really wish to run.
- Harald
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden