This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[PATCH] pthread patch - Thomas Pfaff, please note
- From: Christopher Faylor <cgf at redhat dot com>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 12 Sep 2003 21:25:08 -0400
- Subject: [PATCH] pthread patch - Thomas Pfaff, please note
- Reply-to: cygwin-patches at cygwin dot com
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.
cgf
2003-09-12 Christopher Faylor <cgf@redhat.com>
* thread.cc (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.
Index: thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -p -r1.131 -r1.132
--- thread.cc 26 Jul 2003 04:53:59 -0000 1.131
+++ thread.cc 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);