diff options
author | Christopher Faylor <me@cgf.cx> | 2003-06-02 21:22:02 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-06-02 21:22:02 +0000 |
commit | 3786526ea849a4b7daba6ca5609bf8c4445c894e (patch) | |
tree | c5e90fd103be2fe5bc034a4ec85a86bb5eaec389 /winsup/cygwin | |
parent | cbdc3d178024f9637bdfc3af410572274f6dd91b (diff) | |
download | newlib-3786526ea849a4b7daba6ca5609bf8c4445c894e.zip newlib-3786526ea849a4b7daba6ca5609bf8c4445c894e.tar.gz newlib-3786526ea849a4b7daba6ca5609bf8c4445c894e.tar.bz2 |
* cygthread.h (cygthread::terminate_thread): Mark private.
* cygthread.cc (cygthread::terminate_thread): Deallocate free_range thread
stuff.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.cc | 13 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.h | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 1dbdc00..0ea1da2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2003-06-02 Christopher Faylor <cgf@redhat.com> + + * cygthread.h (cygthread::terminate_thread): Mark private. + * cygthread.cc (cygthread::terminate_thread): Deallocate free_range + thread stuff. + 2003-06-02 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::accept): Rename `signalled' diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index e3c177e..4945c5b 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -258,10 +258,15 @@ cygthread::terminate_thread () system_printf ("VirtualFree of allocation base %p<%p> failed, %E", stack_ptr, m.AllocationBase); - h = NULL; - __name = NULL; - stack_ptr = NULL; - (void) InterlockedExchange (&inuse, 0); /* No longer in use */ + if (is_freerange) + free (this); + else + { + h = NULL; + __name = NULL; + stack_ptr = NULL; + (void) InterlockedExchange (&inuse, 0); /* No longer in use */ + } } /* Detach the cygthread from the current thread. Note that the diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h index 7af3f31..57b50e2 100644 --- a/winsup/cygwin/cygthread.h +++ b/winsup/cygwin/cygthread.h @@ -22,6 +22,7 @@ class cygthread static bool exiting; static DWORD WINAPI stub (VOID *); static DWORD WINAPI simplestub (VOID *); + void terminate_thread (); public: static const char * name (DWORD = 0); cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *); @@ -33,7 +34,6 @@ class cygthread void * operator new (size_t); static cygthread *freerange (); void exit_thread (); - void terminate_thread (); static void terminate (); bool SetThreadPriority (int nPriority) {return ::SetThreadPriority (h, nPriority);} void zap_h () |