From 4ee52924a61bdb2fd8ce7b64d111cf7df4d19fe3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 23 Dec 2004 14:57:08 +0000 Subject: * cygthread.cc (cygthread::stub): Detect if thread function wants to release itself here, to avoid a race. (cygthread::release): Clear more stuff. Add a diagnostic for an internal error. * cygthread.h (auto_release): New function. * pinfo.h (pinfo::remember): Add an argument to denote whether child is detached. * fork.cc (fork_parent): Reflect change in arguments to pinfo::remember. * pinfo.cc (_pinfo::exit): Signal exit more forcibly. (proc_waiter): Use cygthread::auto_release to signify that cygthread::stub should release the thread. This should avoid a race. (pinfo::alert_parent): Don't signify an error when wr_proc_pipe == NULL. * sigproc.cc (proc_subproc): Add support for PROC_DETACHED_CHILD. * sigproc.h: Ditto. * spawn.cc (spawn_guts): Specify whether child is detached or not when calling pinfo::remember. --- winsup/cygwin/pinfo.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/pinfo.h') diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index d4034e154..65168329c 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -168,9 +168,10 @@ public: #ifndef _SIGPROC_H int remember () {system_printf ("remember is not here"); return 0;} #else - int remember () + int remember (bool detach) { - int res = proc_subproc (PROC_ADDCHILD, (DWORD) this); + int res = proc_subproc (detach ? PROC_DETACHED_CHILD : PROC_ADDCHILD, + (DWORD) this); destroy = res ? false : true; return res; } -- cgit v1.2.3