Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-22 19:19:27 +0300
committerChristopher Faylor <me@cgf.cx>2004-12-22 19:19:27 +0300
commit9c0d960d7fd60493bc5336061bb65ba02f8dbdbe (patch)
tree7c3070b83812a8b7ebbd804df5055bb7096bb4bd /winsup/cygwin/cygthread.cc
parent1f490e5712894e58eb4b9151a9123fd928890811 (diff)
* 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/cygthread.cc')
-rw-r--r--winsup/cygwin/cygthread.cc16
1 files changed, 10 insertions, 6 deletions
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