* cygthread.cc (cygthread::stub): Set inuse to false when exiting.
(cygthread::cygthread): Actually pass name as argument to debugging output to avoid SEGV when strace'ing. (cygthread::release): Don't set stack_ptr to NULL, since it is only set once on first entry to a stub not on each stub iteration. (cygthead::exit_thread): Remove obsolete function. * cygthread.h (cygthread::exit_thread): Ditto.
This commit is contained in:
parent
d8c83adc04
commit
538776b743
|
@ -1,3 +1,13 @@
|
||||||
|
2005-01-01 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* cygthread.cc (cygthread::stub): Set inuse to false when exiting.
|
||||||
|
(cygthread::cygthread): Actually pass name as argument to debugging
|
||||||
|
output to avoid SEGV when strace'ing.
|
||||||
|
(cygthread::release): Don't set stack_ptr to NULL, since it is only set
|
||||||
|
once on first entry to a stub not on each stub iteration.
|
||||||
|
(cygthead::exit_thread): Remove obsolete function.
|
||||||
|
* cygthread.h (cygthread::exit_thread): Ditto.
|
||||||
|
|
||||||
2005-01-01 Christopher Faylor <cgf@timesys.com>
|
2005-01-01 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
|
* shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
|
||||||
|
|
|
@ -63,8 +63,11 @@ cygthread::stub (VOID *arg)
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!info->func || exiting)
|
if (exiting)
|
||||||
|
{
|
||||||
|
info->inuse = false; // FIXME: Do we need this?
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Cygwin threads should not call ExitThread directly */
|
/* Cygwin threads should not call ExitThread directly */
|
||||||
info->func (info->arg == cygself ? info : info->arg);
|
info->func (info->arg == cygself ? info : info->arg);
|
||||||
|
@ -167,7 +170,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
|
||||||
while (!thread_sync)
|
while (!thread_sync)
|
||||||
low_priority_sleep (0);
|
low_priority_sleep (0);
|
||||||
SetEvent (thread_sync);
|
SetEvent (thread_sync);
|
||||||
thread_printf ("activated name '%s', thread_sync %p for thread %p", thread_sync, id);
|
thread_printf ("activated name '%s', thread_sync %p for thread %p", name, thread_sync, id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -180,7 +183,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
|
||||||
this, 0, &id);
|
this, 0, &id);
|
||||||
if (!h)
|
if (!h)
|
||||||
api_fatal ("thread handle not set - %p<%p>, %E", h, id);
|
api_fatal ("thread handle not set - %p<%p>, %E", h, id);
|
||||||
thread_printf ("created name '%s', thread %p, id %p", __name, h, id);
|
thread_printf ("created name '%s', thread %p, id %p", name, h, id);
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
terminated = false;
|
terminated = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -224,16 +227,6 @@ HANDLE ()
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should only be called when the process is exiting since it
|
|
||||||
leaves an open thread slot. */
|
|
||||||
void
|
|
||||||
cygthread::exit_thread ()
|
|
||||||
{
|
|
||||||
if (!is_freerange)
|
|
||||||
SetEvent (*this);
|
|
||||||
ExitThread (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cygthread::release (bool nuke_h)
|
cygthread::release (bool nuke_h)
|
||||||
{
|
{
|
||||||
|
@ -241,9 +234,9 @@ cygthread::release (bool nuke_h)
|
||||||
h = NULL;
|
h = NULL;
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
__oldname = __name;
|
__oldname = __name;
|
||||||
|
debug_printf ("released thread '%s'", __oldname);
|
||||||
#endif
|
#endif
|
||||||
__name = NULL;
|
__name = NULL;
|
||||||
stack_ptr = NULL;
|
|
||||||
func = NULL;
|
func = NULL;
|
||||||
if (!InterlockedExchange (&inuse, 0))
|
if (!InterlockedExchange (&inuse, 0))
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
|
|
|
@ -41,7 +41,6 @@ class cygthread
|
||||||
operator HANDLE ();
|
operator HANDLE ();
|
||||||
void * operator new (size_t);
|
void * operator new (size_t);
|
||||||
static cygthread *freerange ();
|
static cygthread *freerange ();
|
||||||
void exit_thread ();
|
|
||||||
static void terminate ();
|
static void terminate ();
|
||||||
bool SetThreadPriority (int nPriority) {return ::SetThreadPriority (h, nPriority);}
|
bool SetThreadPriority (int nPriority) {return ::SetThreadPriority (h, nPriority);}
|
||||||
void zap_h ()
|
void zap_h ()
|
||||||
|
|
Loading…
Reference in New Issue