* pinfo.h (maybe_set_exit_code_from_windows): Renamed from set_exit_state.

* pinfo.cc (pinfo::exit): Use renamed function.
(proc_waiter): Ditto.  Make a copy of input argument to avoid problems when
procs array is shuffled.  Flag when copy is made so that remove_proc knows when
it is safe to reshuffle.
* sigproc.cc (proc_terminate): Don't flag process_state as PID_EXITED.
(remove_proc): Wait for waiter to finish copying pinfo element before moving it
(an actual wait should be an extremely rare event).
This commit is contained in:
Christopher Faylor
2005-01-17 04:12:08 +00:00
parent 459a956197
commit 37d5841f83
4 changed files with 35 additions and 11 deletions

View File

@@ -140,6 +140,7 @@ public:
HANDLE rd_proc_pipe;
HANDLE hProcess;
CRITICAL_SECTION _lock;
bool waiter_ready;
/* Handle associated with initial Windows pid which started it all. */
class cygthread *wait_thread;
void init (pid_t, DWORD, HANDLE = NULL) __attribute__ ((regparm(3)));
@@ -155,7 +156,7 @@ public:
release ();
}
void exit (DWORD n) __attribute__ ((noreturn, regparm(2)));
void set_exit_state () __attribute__ ((regparm(2)));
void maybe_set_exit_code_from_windows () __attribute__ ((regparm(1)));
void initialize_lock () {InitializeCriticalSection (&_lock);}
void lock () {EnterCriticalSection (&_lock);}
void unlock () {LeaveCriticalSection (&_lock);}