[PATCH] stdio initialization

Thomas Pfaff tpfaff@gmx.net
Tue Nov 11 14:44:00 GMT 2003


Christopher Faylor wrote:
> 
> Actually, on poking around a little, I wonder if we should be calling
> _reclaim_reent to get back all of the stuff allocated in the REENT
> structure?
> 

I think you are right.
Here is my patch to thread.cc that i will apply if there are no objections.

diff -urp src.org/thread.cc src/thread.cc
--- src.org/thread.cc	2003-11-11 09:16:39.775574400 +0100
+++ src/thread.cc	2003-11-11 09:21:24.304707200 +0100
@@ -377,6 +377,8 @@ pthread::exit (void *value_ptr)
        mutex.unlock ();
      }

+  (_reclaim_reent) (_REENT);
+
    if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
      ::exit (0);
    else
@@ -1879,6 +1881,7 @@ __reent_t::init_clib (struct _reent& var
    var._stdout = _GLOBAL_REENT->_stdout;
    var._stderr = _GLOBAL_REENT->_stderr;
    var.__sdidinit = _GLOBAL_REENT->__sdidinit;
+  var.__cleanup = _GLOBAL_REENT->__cleanup;
    _clib = &var;
  };



More information about the Cygwin-patches mailing list