OSDN Git Service

* thread.h (__reent_t::init_clib): Declare new function.
authorcgf <cgf>
Sat, 20 Sep 2003 02:43:18 +0000 (02:43 +0000)
committercgf <cgf>
Sat, 20 Sep 2003 02:43:18 +0000 (02:43 +0000)
* thread.cc (__reent_t::init_clib): Define new function.
(pthread::thread_init_wrapper): Use __reent_t::init_clib to init local clib
storage and set std{in,out,err} appropriately.

winsup/cygwin/ChangeLog
winsup/cygwin/thread.cc
winsup/cygwin/thread.h

index 6d794a3..63e0ff7 100644 (file)
@@ -1,5 +1,12 @@
 2003-09-19  Christopher Faylor  <cgf@redhat.com>
 
+       * thread.h (__reent_t::init_clib): Declare new function.
+       * thread.cc (__reent_t::init_clib): Define new function.
+       (pthread::thread_init_wrapper): Use __reent_t::init_clib to init local
+       clib storage and set std{in,out,err} appropriately.
+
+2003-09-19  Christopher Faylor  <cgf@redhat.com>
+
        * syscalls.cc (system): Strip signal considerations from here so that
        they are not inherited by a child process.
        * spawn.cc (spawn_guts): Handle system() signal stuff here.
index 2304b7b..6931b39 100644 (file)
@@ -1769,6 +1769,16 @@ verifyable_object_isvalid (void const * objectptr, long magic)
   return verifyable_object_isvalid (objectptr, magic, NULL);
 }
 
+inline void
+__reent_t::init_clib (struct _reent& var)
+{
+  var = ((struct _reent) _REENT_INIT (var));
+  var._stdin = _GLOBAL_REENT->_stdin;
+  var._stdout = _GLOBAL_REENT->_stdout;
+  var._stderr = _GLOBAL_REENT->_stderr;
+  _clib = &var;
+};
+
 /* Pthreads */
 void *
 pthread::thread_init_wrapper (void *_arg)
@@ -1778,7 +1788,7 @@ pthread::thread_init_wrapper (void *_arg)
   pthread *thread = (pthread *) _arg;
   struct __reent_t local_reent;
   struct _winsup_t local_winsup;
-  struct _reent local_clib = _REENT_INIT (local_clib);
+  struct _reent local_clib;
 
   struct sigaction _sigs[NSIG];
   sigset_t _sig_mask;          /* one set for everything to ignore. */
@@ -1791,7 +1801,7 @@ pthread::thread_init_wrapper (void *_arg)
 
   memset (&local_winsup, 0, sizeof (struct _winsup_t));
 
-  local_reent._clib = &local_clib;
+  local_reent.init_clib (local_clib);
   local_reent._winsup = &local_winsup;
 
   local_winsup._process_logmask = LOG_UPTO (LOG_DEBUG);
index ea1f13f..a52c0b7 100644 (file)
@@ -108,6 +108,7 @@ struct __reent_t
 {
   struct _reent *_clib;
   struct _winsup_t *_winsup;
+  void init_clib (_reent&);
 };
 
 _winsup_t *_reent_winsup ();