* cygthread.cc (cygthread::stub): Initialize stack pointer earlier.
(cygthread::simplestub): Initialize stack pointer. (cygthread::terminate_thread): Account for possibility that stack pointer has not been set. Issue warnings for unusual conditions.
This commit is contained in:
parent
518a04c40b
commit
73afb2abb0
|
@ -1,3 +1,10 @@
|
||||||
|
2003-04-10 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* cygthread.cc (cygthread::stub): Initialize stack pointer earlier.
|
||||||
|
(cygthread::simplestub): Initialize stack pointer.
|
||||||
|
(cygthread::terminate_thread): Account for possibility that stack
|
||||||
|
pointer has not been set. Issue warnings for unusual conditions.
|
||||||
|
|
||||||
2003-04-10 Corinna Vinschen <corinna@vinschen.de>
|
2003-04-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* regex/regex.h: Define regoff_t as _off_t.
|
* regex/regex.h: Define regoff_t as _off_t.
|
||||||
|
|
|
@ -50,12 +50,12 @@ cygthread::stub (VOID *arg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
info->stack_ptr = &arg;
|
||||||
if (!info->ev)
|
if (!info->ev)
|
||||||
{
|
{
|
||||||
info->ev = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
|
info->ev = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
|
||||||
info->thread_sync = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
|
info->thread_sync = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
|
||||||
}
|
}
|
||||||
info->stack_ptr = &arg;
|
|
||||||
}
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +100,7 @@ cygthread::simplestub (VOID *arg)
|
||||||
init_exceptions (&except_entry);
|
init_exceptions (&except_entry);
|
||||||
|
|
||||||
cygthread *info = (cygthread *) arg;
|
cygthread *info = (cygthread *) arg;
|
||||||
|
info->stack_ptr = &arg;
|
||||||
info->func (info->arg == cygself ? info : info->arg);
|
info->func (info->arg == cygself ? info : info->arg);
|
||||||
ExitThread (0);
|
ExitThread (0);
|
||||||
}
|
}
|
||||||
|
@ -175,6 +176,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
stack_ptr = NULL;
|
||||||
h = CreateThread (&sec_none_nih, 0, is_freerange ? simplestub : stub,
|
h = CreateThread (&sec_none_nih, 0, is_freerange ? simplestub : stub,
|
||||||
this, 0, &id);
|
this, 0, &id);
|
||||||
if (!h)
|
if (!h)
|
||||||
|
@ -243,13 +245,18 @@ cygthread::terminate_thread ()
|
||||||
(void) WaitForSingleObject (h, INFINITE);
|
(void) WaitForSingleObject (h, INFINITE);
|
||||||
CloseHandle (h);
|
CloseHandle (h);
|
||||||
|
|
||||||
|
while (!stack_ptr)
|
||||||
|
low_priority_sleep (0);
|
||||||
|
|
||||||
MEMORY_BASIC_INFORMATION m;
|
MEMORY_BASIC_INFORMATION m;
|
||||||
memset (&m, 0, sizeof (m));
|
memset (&m, 0, sizeof (m));
|
||||||
(void) VirtualQuery (stack_ptr, &m, sizeof m);
|
(void) VirtualQuery (stack_ptr, &m, sizeof m);
|
||||||
|
|
||||||
if (m.RegionSize)
|
if (!m.RegionSize)
|
||||||
(void) VirtualFree (m.AllocationBase, 0, MEM_RELEASE);
|
system_printf ("m.RegionSize 0? stack_ptr %p", stack_ptr);
|
||||||
|
else if (!VirtualFree (m.AllocationBase, 0, MEM_RELEASE))
|
||||||
|
system_printf ("VirtualFree of allocation base %p<%p> failed, %E",
|
||||||
|
stack_ptr, m.AllocationBase);
|
||||||
|
|
||||||
h = NULL;
|
h = NULL;
|
||||||
__name = NULL;
|
__name = NULL;
|
||||||
|
|
Loading…
Reference in New Issue