Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-10-18 03:27:00 +0400
committerChristopher Faylor <me@cgf.cx>2005-10-18 03:27:00 +0400
commit267e201dae394e2d5deaa00fc2d4904a311210d8 (patch)
tree987ed376cf4af33ebd83038e81ed295158f5f671 /winsup/cygwin/pinfo.cc
parent8b00a766ff6986a76a794e3b21539023910dacd3 (diff)
Change process_lock to lock_process throughout. Change all calls to new
cygthread to handle extra argument, throughout. * cygthread.h (cygthread::callproc): Declare new method. (cygthread::cygthread): Add optional length argument to allow copying arguments to executing thread. * cygthread.cc (cygthread::callproc): Define new method. (cygthread::stub): Use callfunc to invoke thread func to allow potentially allocating stack memory which will be returned. (cygthread::simplestub): Ditto. (cygthread::cygthread): Accept arglen argument. Reset ev here prior to activating thread. Wait for ev after activating thread if we're copying contents to the thread. Wait until the end before setting h, to allow thread synchronization. (cygthread::release): Don't reset ev here. Rely on that happening the next time the thread is activated. * pinfo.h (commune_process): Rename declaration from _pinfo::commune_process. * pinfo.cc (commune_process): Ditto for definition. Modify slightly to allow running as a separate cygthread. * sigproc.cc (child_info::sync): Always wait for both subproc_ready and any hProcess if we have a cygwin parent. (talktome): Change argument to be a pointer to siginfo_t. Contiguously allocate whole siginfo_t structure + any needed extra for eventual passing to commune_process thread. (wait_sig): Accommodate change in talktome argument. * pipe.cc (fhandler_pipe::fixup_after_exec): Remove debugging.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 5df86c730..26d910cfe 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -139,8 +139,9 @@ pinfo::zap_cwd ()
void
pinfo::exit (DWORD n)
{
- process_lock until_exit ();
+ lock_process until_exit ();
cygthread::terminate ();
+
if (n != EXITCODE_NOSET)
self->exitcode = EXITCODE_SET | n;/* We're really exiting. Record the UNIX exit code. */
else
@@ -378,9 +379,10 @@ _pinfo::alive ()
extern char **__argv;
-void
-_pinfo::commune_process (siginfo_t& si)
+DWORD WINAPI
+commune_process (void *arg)
{
+ siginfo_t& si = *((siginfo_t *) arg);
char path[CYG_MAX_PATH];
DWORD nr;
HANDLE& tothem = si._si_commune._si_write_handle;
@@ -389,7 +391,7 @@ _pinfo::commune_process (siginfo_t& si)
if (process_sync) // FIXME: this test shouldn't be necessary
ProtectHandle (process_sync);
- process_lock now (false);
+ lock_process now (false);
switch (si._si_commune._si_code)
{
@@ -546,6 +548,8 @@ _pinfo::commune_process (siginfo_t& si)
ForceCloseHandle (process_sync);
}
CloseHandle (tothem);
+ _my_tls._ctinfo->auto_release ();
+ return 0;
}
commune_result
@@ -587,7 +591,7 @@ _pinfo::commune_request (__uint32_t code, ...)
break;
}
- process_lock now ();
+ lock_process now ();
locked = true;
char name_buf[CYG_MAX_PATH];
request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX,
@@ -959,7 +963,7 @@ pinfo::wait ()
waiter_ready = false;
/* Fire up a new thread to track the subprocess */
- cygthread *h = new cygthread (proc_waiter, this, "proc_waiter");
+ cygthread *h = new cygthread (proc_waiter, 0, this, "proc_waiter");
if (!h)
sigproc_printf ("tracking thread creation failed for pid %d", (*this)->pid);
else