diff options
author | Christopher Faylor <me@cgf.cx> | 2004-12-22 16:19:27 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-12-22 16:19:27 +0000 |
commit | 9c0d960d7fd60493bc5336061bb65ba02f8dbdbe (patch) | |
tree | 7c3070b83812a8b7ebbd804df5055bb7096bb4bd /winsup/cygwin | |
parent | 1f490e5712894e58eb4b9151a9123fd928890811 (diff) | |
download | cygnal-9c0d960d7fd60493bc5336061bb65ba02f8dbdbe.tar.gz cygnal-9c0d960d7fd60493bc5336061bb65ba02f8dbdbe.tar.bz2 cygnal-9c0d960d7fd60493bc5336061bb65ba02f8dbdbe.zip |
* 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().
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.cc | 16 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.h | 2 |
3 files changed, 18 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index afc832e47..88148bf55 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index 1f071b847..d20bf6853 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -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 diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h index 4517b9232..ae7ff9292 100644 --- a/winsup/cygwin/cygthread.h +++ b/winsup/cygwin/cygthread.h @@ -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 (); |