aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-02-11 15:24:15 +0000
committerChristopher Faylor <me@cgf.cx>2005-02-11 15:24:15 +0000
commitcc9440b6f42536f9f3b3fca6a6c53155792a51eb (patch)
tree7839100d471d0478d72881287053dde865e70bb4 /winsup/cygwin/pinfo.cc
parent199bf79367fd838d12900e70c05756f2bc29db5d (diff)
downloadnewlib-cc9440b6f42536f9f3b3fca6a6c53155792a51eb.zip
newlib-cc9440b6f42536f9f3b3fca6a6c53155792a51eb.tar.gz
newlib-cc9440b6f42536f9f3b3fca6a6c53155792a51eb.tar.bz2
* cygthread.cc (cygthread::release): Reset ev here if it exists.
(cygthread::terminate_thread): Eliminat racy code which reset ev and thread_sync. Remove a few nonsensical inuse checks. Exit at the bottom. (cygthread::detach): Rewrite to again try to ensure that we don't say we're signalled when we are not signalled. * fhandler.cc (fhandler_base::raw_read): Revert to signalling read success quickly. * pipe.cc (fhandler_pipe::close): Use base method to close handle. * sigproc.h (WAIT_SIG_PRIORITY): Just trundle along at normal priority to allow the pipe thread to do its thing if possible. * pinfo.h (pinfo::zap_cwd): Declare new function. (pinfo::zap_cwd): Move 'cd out of the way code' here. (pinfo::exit): Use it here. * spawn.cc (spawn_guts): And here.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 367ecd1..eedb69a 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -124,6 +124,16 @@ pinfo::maybe_set_exit_code_from_windows ()
}
void
+pinfo::zap_cwd ()
+{
+ extern char windows_system_directory[];
+ /* Move to an innocuous location to avoid a race with other processes
+ that may want to manipulate the current directory before this
+ process has completely exited. */
+ (void) SetCurrentDirectory (windows_system_directory);
+}
+
+void
pinfo::exit (DWORD n)
{
exit_state = ES_FINAL;
@@ -144,11 +154,7 @@ pinfo::exit (DWORD n)
if (n != EXITCODE_NOSET)
{
- extern char windows_system_directory[];
- /* Move to an innocuous location to avoid a race with other processes
- that may want to manipulate the current directory before this
- process has completely exited. */
- (void) SetCurrentDirectory (windows_system_directory);
+ zap_cwd ();
self->alert_parent (0); /* Shave a little time by telling our
parent that we have now exited. */
}