summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-13 18:16:33 +0000
committerChristopher Faylor <me@cgf.cx>2002-10-13 18:16:33 +0000
commit3f5046a540af860ee6045156becbeb71fa05b220 (patch)
tree20d1e2888b0ea2917df4507f39c1014d64d3789a /winsup/cygwin/spawn.cc
parent5cafa3aa1a57a1c1931b8df90ecb0aca91b1eb6d (diff)
downloadcygnal-3f5046a540af860ee6045156becbeb71fa05b220.tar.gz
cygnal-3f5046a540af860ee6045156becbeb71fa05b220.tar.bz2
cygnal-3f5046a540af860ee6045156becbeb71fa05b220.zip
* cygthread.cc (cygthread::stub): Don't create event for long-running threads.
Initialize thread_sync event here which is used to Suspend using an event rather than relying on SuspendThread/ResumeThread. (cygthread::init): Save handle to runner thread for future termination. (cygthread::cygthread): Only resume thread when it is actually suspended. Otherwise signal thread completion event. (cygthread::terminate): Forcibly terminate runner thread and any helper threads. Call DisableThreadLibrary calls if execing. * cygthread.h (cygthread::thread_sync): Declare. * dcrt0.cc (do_exit): Eliminate calls to obsolete window_terminate and shared_terminate. * exceptions.cc (events_terminate): Don't bother closing title_mutex since it is going away anyway. * pinfo.cc (_pinfo::exit): Call cygthread::terminate to ensure that threads are shut down before process exit or otherwise strange races seem to occur. * shared.cc (shared_terminate): Eliminate. * shared.h (shared_terminate): Eliminate declaration. * winsup.h (window_terminate): Eliminate declaration. * spawn.cc (spawn_guts): Call cygthread::terminate early in process if execing. Call DisableThreadLibrary calls if execing. * window.cc (Winmain): Call ExitThread to force exit. (window_terminate): Eliminate. * dcrt0.cc (do_exit): Track exit state more closely.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 34927c1f0..b3bf304fb 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -34,6 +34,7 @@ details. */
#include "perthread.h"
#include "registry.h"
#include "environ.h"
+#include "cygthread.h"
#define LINE_BUF_CHUNK (MAX_PATH * 2)
@@ -715,12 +716,13 @@ spawn_guts (const char * prog_arg, const char *const *argv,
cygheap_setup_for_child_cleanup (newheap, &ciresrv, 1);
if (mode == _P_OVERLAY)
ResumeThread (pi.hThread);
+ cygthread::terminate ();
}
- if (mode == _P_OVERLAY)
- cygpid = myself->pid;
- else
+ if (mode != _P_OVERLAY)
cygpid = cygwin_pid (pi.dwProcessId);
+ else
+ cygpid = myself->pid;
/* We print the original program name here so the user can see that too. */
syscall_printf ("%d = spawn_guts (%s, %.132s)",