[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 170) How do I make a "busy cursor" while my application is computing?
Next Document: 172) Why doesn't anything appear when I run this simple program?


171) How do I fork without hanging my parent X program?



	An X-based application which spawns off other Unix processes which 
continue to run after it is closed typically does not vanish until all of its 
children are terminated; the children inherit from the parent the open X 
connection to the display. 
	What you need to do is fork; then, immediately, in the child process, 
		close (ConnectionNumber(XtDisplay(widget)));
to close the file-descriptor in the display information. After this do your 
exec. You will then be able to exit the parent.
	Alternatively, before exec'ing make this call, which causes the file 
descriptor to be closed on exec.
		(void) fcntl(ConnectionNumber(XDisplay), F_SETFD, 1);

[Thanks to Janet Anstett (anstettj@tramp.Colorado.EDU), Gordon Freedman 
(gjf00@duts.ccc.amdahl.com); 2/91. Greg Holmberg (holmberg@frame.com), 3/93.]



Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 170) How do I make a "busy cursor" while my application is computing?
Next Document: 172) Why doesn't anything appear when I run this simple program?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)

Last Update October 22 2009 @ 05:36 AM

Some parts © 2009 Advameg, Inc.