OSDN Git Service

* cygthread.h (cygthread::release): Just declare here.
authorcgf <cgf>
Wed, 22 Dec 2004 16:19:24 +0000 (16:19 +0000)
committercgf <cgf>
Wed, 22 Dec 2004 16:19:24 +0000 (16:19 +0000)
* cygthread.cc (cygthread::release): Define here.  Use InterlockedExchange to
set inuse or suffer potential races.
(cygthread::terminate): Use release().

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

index afc832e..88148bf 100644 (file)
@@ -1,3 +1,10 @@
+2004-12-22  Christopher Faylor  <cgf@timesys.com>
+
+       * cygthread.h (cygthread::release): Just declare here.
+       * cygthread.cc (cygthread::release): Define here.  Use
+       InterlockedExchange to set inuse or suffer potential races.
+       (cygthread::terminate): Use release().
+
 2004-12-22  Chris January  <chris@atomice.net>
 
        * fhandler_process.cpp (format_process_status): Use tabs in formatting
index 1f071b8..d20bf68 100644 (file)
@@ -213,6 +213,15 @@ cygthread::exit_thread ()
   ExitThread (0);
 }
 
+void
+cygthread::release ()
+{
+  h = NULL;
+  __name = NULL;
+  stack_ptr = NULL;
+  (void) InterlockedExchange (&inuse, 0); /* No longer in use */
+}
+
 /* Forcibly terminate a thread. */
 void
 cygthread::terminate_thread ()
@@ -242,12 +251,7 @@ cygthread::terminate_thread ()
   if (is_freerange)
     free (this);
   else
-    {
-      h = NULL;
-      __name = NULL;
-      stack_ptr = NULL;
-      (void) InterlockedExchange (&inuse, 0); /* No longer in use */
-    }
+    release ();
 }
 
 /* Detach the cygthread from the current thread.  Note that the
index 4517b92..ae7ff92 100644 (file)
@@ -28,7 +28,7 @@ class cygthread
   static DWORD WINAPI simplestub (VOID *);
   static DWORD main_thread_id;
   static const char * name (DWORD = 0);
-  void release () { __name = NULL; inuse = false; }
+  void release ();
   cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *);
   cygthread () {};
   static void init ();