From 2ea71c00972e4c31082f58349030ef85d89208c3 Mon Sep 17 00:00:00 2001 From: cgf Date: Sun, 5 Dec 2004 21:29:37 +0000 Subject: [PATCH] * cygthread.cc (cygthread::terminate_thread): Make public. * pinfo.h (pinfo::wait_thread): New element. * pinfo.cc (pinfo::wait): Store "handle" to started thread in pinfo. * sigproc.cc (proc_terminate): Kill any threads waiting for a process pipe. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/cygthread.h | 2 +- winsup/cygwin/pinfo.cc | 2 +- winsup/cygwin/pinfo.h | 1 + winsup/cygwin/sigproc.cc | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 74423f2f4b..e6986dccee 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,13 @@ 2004-12-05 Christopher Faylor + * cygthread.cc (cygthread::terminate_thread): Make public. + * pinfo.h (pinfo::wait_thread): New element. + * pinfo.cc (pinfo::wait): Store "handle" to started thread in pinfo. + * sigproc.cc (proc_terminate): Kill any threads waiting for a process + pipe. + +2004-12-05 Christopher Faylor + * sigproc.cc (mychild): Reimplement as list scan. (proc_subproc): Don't mess with pinfo if it's myself. diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h index dfeef90de4..4517b92321 100644 --- a/winsup/cygwin/cygthread.h +++ b/winsup/cygwin/cygthread.h @@ -22,8 +22,8 @@ class cygthread VOID *arg; bool is_freerange; static bool exiting; - void terminate_thread (); public: + void terminate_thread (); static DWORD WINAPI stub (VOID *); static DWORD WINAPI simplestub (VOID *); static DWORD main_thread_id; diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index ebc6d07b9a..8d6a7dafad 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -833,7 +833,7 @@ pinfo::wait () sigproc_printf ("tracking thread creation failed for pid %d", (*this)->pid); else { - h->zap_h (); + wait_thread = h; sigproc_printf ("created tracking thread for pid %d, winpid %p, rd_pipe %p", (*this)->pid, (*this)->dwProcessId, rd_proc_pipe); } diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index c249fe1744..e460eed65c 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -137,6 +137,7 @@ public: CRITICAL_SECTION _lock; /* Handle associated with initial Windows pid which started it all. */ HANDLE pid_handle; + class cygthread *wait_thread; void init (pid_t, DWORD, HANDLE = NULL) __attribute__ ((regparm(3))); pinfo () {} pinfo (_pinfo *x): procinfo (x), hProcess (NULL), pid_handle (NULL) {} diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index d7c57b1d2e..bc1d6fff60 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -401,6 +401,11 @@ proc_terminate (void) procs[i]->ppid = 1; if (!proc_exists (procs[i])) procs[i]->process_state = PID_EXITED; /* CGF FIXME - still needed? */ + if (procs[i].wait_thread) + { + // CloseHandle (procs[i].rd_proc_pipe); + procs[i].wait_thread->terminate_thread (); + } procs[i].release (); } nprocs = 0; -- 2.11.0