bug-commoncpp
[Top][All Lists]
Advanced

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

Re: Process::spawn() and atexit()


From: Federico Montesino Pouzols
Subject: Re: Process::spawn() and atexit()
Date: Sat, 18 Jan 2003 16:03:06 +0100
User-agent: Mutt/1.4i

        I see, I have added a '@warning' tag with a paragraph on this
issue to the spawn doxygen doc.

On Fri, Jan 17, 2003 at 02:28:21PM -0500, Ian Gough wrote:
> On Win32, Process::spawn() blocks as it spawns a new process. On all
> other platforms, it forks, execs and then waits. The side effect comes
> in that the parent process of the fork then exits, which causes the
> function set up in atexit() to be called.
>  
> Normally, this wouldn't cause a problem, but the app I am building is a
> server that spawns multiple processes and sets up communications links
> to each of the children. To make sure the system gets shutdown
> gracefully, in the atexit function I caused the server to tell each of
> the children to quit gracefully. Now this works fine in Win32, but on
> unix, due to the forking, the atexit function gets called when the
> parent process of the fork exits, which causes the shutdown message to
> be sent to the child processes before the server portion is actually
> exiting, thereby tearing down half the system.
>  
> I think that perhaps this side effect needs to be documented for the
> Process::spawn() method so that people can be aware there are issues
> with using atexit() and spawn().
>  
>  

> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]