removed from proc_subproc linked list.
* cygtls.h (_cygtls::remove_wq): Declare.
* sigproc.cc (_cygtls::remove_wq): Define.
(proc_subproc): Label event handle appropriately.
* spawn.cc (spawn_guts): Return -1 when wait() fails for spawn types that
require waiting.
+2004-03-14 Christopher Faylor <cgf@redhat.com>
+
+ * cygtls.cc (_cygtls::remove): Call remove_wq to ensure that wait stuff
+ is removed from proc_subproc linked list.
+ * cygtls.h (_cygtls::remove_wq): Declare.
+ * sigproc.cc (_cygtls::remove_wq): Define.
+ (proc_subproc): Label event handle appropriately.
+ * spawn.cc (spawn_guts): Return -1 when wait() fails for spawn types
+ that require waiting.
+
2004-03-12 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Handle ERROR_BUS_RESET.
if (i < --nthreads)
cygheap->threadlist[i] = cygheap->threadlist[nthreads];
debug_printf ("removed %p element %d", this, i);
+ remove_wq ();
break;
}
}
void set_threadkill () {threadkill = true;}
void reset_threadkill () {threadkill = false;}
int call_signal_handler () __attribute__ ((regparm (1)));
+ void remove_wq () __attribute__ ((regparm (1)));
void fixup_after_fork () __attribute__ ((regparm (1)));
void lock () __attribute__ ((regparm (1)));
void unlock () __attribute__ ((regparm (1)));
{
wval->ev = wval->thread_ev = CreateEvent (&sec_none_nih, TRUE,
FALSE, NULL);
- ProtectHandle (wval->ev);
+ ProtectHandle1 (wval->ev, wq_ev);
}
ResetEvent (wval->ev);
return rc;
}
+// FIXME: This is inelegant
+void
+_cygtls::remove_wq ()
+{
+ sync_proc_subproc->acquire ();
+ for (waitq *w = &waitq_head; w->next != NULL; w = w->next)
+ if (w->next == &wq)
+ {
+ ForceCloseHandle1 (wq.thread_ev, wq_ev);
+ w->next = wq.next;
+ break;
+ }
+ sync_proc_subproc->release ();
+}
+
/* Terminate the wait_subproc thread.
* Called on process exit.
* Also called by spawn_guts to disassociate any subprocesses from this
break;
case _P_WAIT:
case _P_SYSTEM:
- waitpid (cygpid, (int *) &res, 0);
+ if (waitpid (cygpid, (int *) &res, 0) != cygpid)
+ res = -1;
break;
case _P_DETACH:
res = 0; /* Lose all memory of this child. */