diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 74423f2f4..e6986dcce 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +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. diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h index dfeef90de..4517b9232 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 ebc6d07b9..8d6a7dafa 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 c249fe174..e460eed65 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 d7c57b1d2..bc1d6fff6 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;