* 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().
This commit is contained in:
parent
1f490e5712
commit
9c0d960d7f
@ -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>
|
2004-12-22 Chris January <chris@atomice.net>
|
||||||
|
|
||||||
* fhandler_process.cpp (format_process_status): Use tabs in formatting
|
* fhandler_process.cpp (format_process_status): Use tabs in formatting
|
||||||
|
@ -213,6 +213,15 @@ cygthread::exit_thread ()
|
|||||||
ExitThread (0);
|
ExitThread (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cygthread::release ()
|
||||||
|
{
|
||||||
|
h = NULL;
|
||||||
|
__name = NULL;
|
||||||
|
stack_ptr = NULL;
|
||||||
|
(void) InterlockedExchange (&inuse, 0); /* No longer in use */
|
||||||
|
}
|
||||||
|
|
||||||
/* Forcibly terminate a thread. */
|
/* Forcibly terminate a thread. */
|
||||||
void
|
void
|
||||||
cygthread::terminate_thread ()
|
cygthread::terminate_thread ()
|
||||||
@ -242,12 +251,7 @@ cygthread::terminate_thread ()
|
|||||||
if (is_freerange)
|
if (is_freerange)
|
||||||
free (this);
|
free (this);
|
||||||
else
|
else
|
||||||
{
|
release ();
|
||||||
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
|
/* Detach the cygthread from the current thread. Note that the
|
||||||
|
@ -28,7 +28,7 @@ class cygthread
|
|||||||
static DWORD WINAPI simplestub (VOID *);
|
static DWORD WINAPI simplestub (VOID *);
|
||||||
static DWORD main_thread_id;
|
static DWORD main_thread_id;
|
||||||
static const char * name (DWORD = 0);
|
static const char * name (DWORD = 0);
|
||||||
void release () { __name = NULL; inuse = false; }
|
void release ();
|
||||||
cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *);
|
cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *);
|
||||||
cygthread () {};
|
cygthread () {};
|
||||||
static void init ();
|
static void init ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user