OSDN Git Service

* cygthread.cc (cygthread::stub): Set inuse to false when exiting.
authorcgf <cgf>
Sun, 2 Jan 2005 02:22:25 +0000 (02:22 +0000)
committercgf <cgf>
Sun, 2 Jan 2005 02:22:25 +0000 (02:22 +0000)
(cygthread::cygthread): Actually pass name as argument to debugging output to
avoid SEGV when strace'ing.
(cygthread::release): Don't set stack_ptr to NULL, since it is only set once on
first entry to a stub not on each stub iteration.
(cygthead::exit_thread): Remove obsolete function.
* cygthread.h (cygthread::exit_thread): Ditto.

winsup/cygwin/ChangeLog
winsup/cygwin/cygthread.cc
winsup/cygwin/cygthread.h

index 26d3a35..a6e9a70 100644 (file)
@@ -1,5 +1,15 @@
 2005-01-01  Christopher Faylor  <cgf@timesys.com>
 
+       * cygthread.cc (cygthread::stub): Set inuse to false when exiting.
+       (cygthread::cygthread): Actually pass name as argument to debugging
+       output to avoid SEGV when strace'ing.
+       (cygthread::release): Don't set stack_ptr to NULL, since it is only set
+       once on first entry to a stub not on each stub iteration.
+       (cygthead::exit_thread): Remove obsolete function.
+       * cygthread.h (cygthread::exit_thread): Ditto.
+
+2005-01-01  Christopher Faylor  <cgf@timesys.com>
+
        * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
        attempt to map memory fails.
 
        Do not set mount_table->had_to_create_mount_areas.
        * path.cc (mount_info::conv_to_win32_path): Improve update of
        sys_mount_table_counter.
-       (mount_info::read_mounts): Use new reg_key constructor. 
+       (mount_info::read_mounts): Use new reg_key constructor.
        (mount_info::add_reg_mount): Ditto.
        (mount_info::del_reg_mount): Ditto.
        (mount_info::read_cygdrive_info_from_registry): Ditto.
 
        * registry.cc (get_registry_hive_path): Simplify and add a
        debug_printf in case of failure.
-       (load_registry_hive): Revert the 2004-04-19 change.     
+       (load_registry_hive): Revert the 2004-04-19 change.
 
 2004-10-20  Christopher Faylor  <cgf@timesys.com>
 
index 55022f3..9899012 100644 (file)
@@ -63,8 +63,11 @@ cygthread::stub (VOID *arg)
 #endif
       else
        {
-         if (!info->func || exiting)
-           return 0;
+         if (exiting)
+           {
+             info->inuse = false;      // FIXME: Do we need this?
+             return 0;
+           }
 
          /* Cygwin threads should not call ExitThread directly */
          info->func (info->arg == cygself ? info : info->arg);
@@ -167,7 +170,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
       while (!thread_sync)
        low_priority_sleep (0);
       SetEvent (thread_sync);
-      thread_printf ("activated name '%s', thread_sync %p for thread %p", thread_sync, id);
+      thread_printf ("activated name '%s', thread_sync %p for thread %p", name, thread_sync, id);
     }
   else
     {
@@ -180,7 +183,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
                        this, 0, &id);
       if (!h)
        api_fatal ("thread handle not set - %p<%p>, %E", h, id);
-      thread_printf ("created name '%s', thread %p, id %p", __name, h, id);
+      thread_printf ("created name '%s', thread %p, id %p", name, h, id);
 #ifdef DEBUGGING
       terminated = false;
 #endif
@@ -224,16 +227,6 @@ HANDLE ()
   return ev;
 }
 
-/* Should only be called when the process is exiting since it
-   leaves an open thread slot. */
-void
-cygthread::exit_thread ()
-{
-  if (!is_freerange)
-    SetEvent (*this);
-  ExitThread (0);
-}
-
 void
 cygthread::release (bool nuke_h)
 {
@@ -241,9 +234,9 @@ cygthread::release (bool nuke_h)
     h = NULL;
 #ifdef DEBUGGING
   __oldname = __name;
+  debug_printf ("released thread '%s'", __oldname);
 #endif
   __name = NULL;
-  stack_ptr = NULL;
   func = NULL;
   if (!InterlockedExchange (&inuse, 0))
 #ifdef DEBUGGING
index 81cb681..7e659d0 100644 (file)
@@ -41,7 +41,6 @@ class cygthread
   operator HANDLE ();
   void * operator new (size_t);
   static cygthread *freerange ();
-  void exit_thread ();
   static void terminate ();
   bool SetThreadPriority (int nPriority) {return ::SetThreadPriority (h, nPriority);}
   void zap_h ()