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-28 04:27:26 +0300
committerChristopher Faylor <me@cgf.cx>2004-12-28 04:27:26 +0300
commit57ba174fa0fd038154f5f24a32cad566796ee2a6 (patch)
tree2ec65739c0f0ddbf83d1a22d7b1ca635c65c594d /winsup/cygwin/cygthread.cc
parent432524c16251a6d40716978ac4d0eb1188b1256a (diff)
* cygthread.cc (cygthread::stub): Add better debug output.
(cygthread::cygthread): Ditto. (cygthread::terminate_thread): Ditto. Move inuse test earlier or suffer infinite loop. * pinfo.cc (_pinfo::dup_proc_pipe): Close handle if DuplicateHandle fails and process no longer exists. * spawn.cc (spawn_guts): Create process in suspended state if OS demands it. * wincap.cc: Add "start_proc_suspended" throughout. * wincap.h (wincaps): Ditto. (wincapc): Ditto.
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 20f51d593..55022f370 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -45,6 +45,7 @@ cygthread::stub (VOID *arg)
else
{
info->stack_ptr = &arg;
+ debug_printf ("thread '%s', id %p, stack_ptr %p", info->name (), info->id, info->stack_ptr);
if (!info->ev)
{
info->ev = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
@@ -166,7 +167,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
while (!thread_sync)
low_priority_sleep (0);
SetEvent (thread_sync);
- thread_printf ("activated thread_sync %p", thread_sync);
+ thread_printf ("activated name '%s', thread_sync %p for thread %p", thread_sync, id);
}
else
{
@@ -179,7 +180,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
this, 0, &id);
if (!h)
api_fatal ("thread handle not set - %p<%p>, %E", h, id);
- thread_printf ("created thread %p", h);
+ thread_printf ("created name '%s', thread %p, id %p", __name, h, id);
#ifdef DEBUGGING
terminated = false;
#endif
@@ -268,18 +269,21 @@ cygthread::terminate_thread ()
ResetEvent (*this);
ResetEvent (thread_sync);
}
+
+ debug_printf ("thread '%s', id %p, inuse %d, stack_ptr %p", name (), id, inuse, stack_ptr);
+ while (inuse && !stack_ptr)
+ low_priority_sleep (0);
+
if (!inuse)
return;
+
(void) TerminateThread (h, 0);
(void) WaitForSingleObject (h, INFINITE);
- if (!inuse)
+ if (!inuse || exiting)
return;
CloseHandle (h);
- while (inuse && !stack_ptr)
- low_priority_sleep (0);
-
if (!inuse)
return;