This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: How to make child of failed fork exit cleanly?
On Wed, May 04, 2011 at 05:33:57PM +0200, Corinna Vinschen wrote:
>> That said, I've implemented what you suggested (reversing the sense
>> of dll::has_dtors until fork fixup completes), and it seems to
>> behave properly. I still wonder, though: can we expect all dlls to
>> behave properly if (from their perspective) some library they
>> communicate with has ceased to exist without detaching?
>
>It's a good assumption for a start. If it turns out to be incorrect,
>we can take another look.
Wouldn't this do what's required pretty simply?
cgf
--- dll_init.cc 2 May 2011 15:28:34 -0000 1.81
+++ dll_init.cc 4 May 2011 15:57:26 -0000
@@ -37,6 +37,8 @@ static bool dll_global_dtors_recorded;
void
dll_global_dtors ()
{
+ if (in_forkee)
+ return;
int recorded = dll_global_dtors_recorded;
dll_global_dtors_recorded = false;
if (recorded && dlls.start.next)