This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] pthread patch - Thomas Pfaff, please note

Thomas, I made the change below to stop a SEGV on thread exit as evinced
by the threadidafterfork test in the testsuite.

The problem is that this code overwrites impure_ptr with the contents of
the thread which called fork, which is not the correct thing to do since
_impure_ptr contains global information not present in the calling threads
reent structure.

I hope it makes sense.  If there is some better way to do this, please
feel free to check it in.  This looked right to me, though.


2003-09-12  Christopher Faylor  <>

        * (MTinterface::fixup_after_fork): Remove code which 
        potentially overwrote _impure pointer with contents of thread which
        invoked fork since this eliminates important information like the
        pointer to the atexit queue.

RCS file: /cvs/src/src/winsup/cygwin/,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -p -r1.131 -r1.132
---	26 Jul 2003 04:53:59 -0000	1.131
+++	13 Sep 2003 01:21:32 -0000	1.132
@@ -224,10 +224,6 @@ MTinterface::fixup_after_fork (void)
   /* As long as the signal handling not multithreaded
      switch reents storage back to _impure_ptr for the mainthread
      to support fork from threads other than the mainthread */
-  struct _reent *reent_old = __getreent ();
-  if (reent_old && _impure_ptr != reent_old)
-    *_impure_ptr = *reent_old;
   reents._clib = _impure_ptr;
   reents._winsup = &winsup_reent;
   winsup_reent._process_logmask = LOG_UPTO (LOG_DEBUG);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]