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.
This commit is contained in:
Christopher Faylor 2005-10-17 23:27:00 +00:00
parent 8b00a766ff
commit 267e201dae
18 changed files with 163 additions and 86 deletions

View File

@ -1,3 +1,32 @@
2005-10-17 Christopher Faylor <cgf@timesys.com>
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.
2005-10-17 Corinna Vinschen <corinna@vinschen.de> 2005-10-17 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Never load wsock32.dll. Load all wsock32 function * autoload.cc: Never load wsock32.dll. Load all wsock32 function

View File

@ -54,7 +54,7 @@ public:
child_info (): subproc_ready (NULL), parent (NULL) {} child_info (): subproc_ready (NULL), parent (NULL) {}
~child_info (); ~child_info ();
void ready (bool); void ready (bool);
bool sync (int, HANDLE, DWORD) __attribute__ ((regparm (3))); bool sync (int, HANDLE&, DWORD) __attribute__ ((regparm (3)));
}; };
class mount_info; class mount_info;

View File

@ -415,11 +415,11 @@ class cygheap_fdenum : public cygheap_fdmanip
} }
}; };
class process_lock class lock_process
{ {
bool skip_unlock; bool skip_unlock;
public: public:
process_lock (bool exiting = false) lock_process (bool exiting = false)
{ {
cygheap->fdtab.lock (); cygheap->fdtab.lock ();
skip_unlock = exiting; skip_unlock = exiting;
@ -429,7 +429,7 @@ public:
muto::set_exiting_thread (); muto::set_exiting_thread ();
} }
} }
~process_lock () ~lock_process ()
{ {
if (!skip_unlock) if (!skip_unlock)
cygheap->fdtab.unlock (); cygheap->fdtab.unlock ();

View File

@ -25,6 +25,36 @@ static cygthread NO_COPY threads[32];
DWORD NO_COPY cygthread::main_thread_id; DWORD NO_COPY cygthread::main_thread_id;
bool NO_COPY cygthread::exiting; bool NO_COPY cygthread::exiting;
void
cygthread::callfunc (bool issimplestub)
{
void *pass_arg;
if (arg == cygself)
pass_arg = this;
else if (!arglen)
pass_arg = arg;
else
{
if (issimplestub)
ev = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
pass_arg = alloca (arglen);
memcpy (pass_arg, arg, arglen);
SetEvent (ev);
}
if (issimplestub)
{
/* Wait for main thread to assign 'h' */
while (!h)
low_priority_sleep (0);
if (ev)
CloseHandle (ev);
ev = h;
}
/* Cygwin threads should not call ExitThread directly */
func (pass_arg);
/* ...so the above should always return */
}
/* Initial stub called by cygthread constructor. Performs initial /* Initial stub called by cygthread constructor. Performs initial
per-thread initialization and loops waiting for another thread function per-thread initialization and loops waiting for another thread function
to execute. */ to execute. */
@ -69,9 +99,7 @@ cygthread::stub (VOID *arg)
return 0; return 0;
} }
/* Cygwin threads should not call ExitThread directly */ info->callfunc (false);
info->func (info->arg == cygself ? info : info->arg);
/* ...so the above should always return */
HANDLE notify = info->notify_detached; HANDLE notify = info->notify_detached;
/* If func is NULL, the above function has set that to indicate /* If func is NULL, the above function has set that to indicate
@ -111,11 +139,7 @@ cygthread::simplestub (VOID *arg)
cygthread *info = (cygthread *) arg; cygthread *info = (cygthread *) arg;
_my_tls._ctinfo = info; _my_tls._ctinfo = info;
info->stack_ptr = &arg; info->stack_ptr = &arg;
/* Wait for main thread to assign 'h' */ info->callfunc (true);
while (!info->h)
low_priority_sleep (0);
info->ev = info->h;
info->func (info->arg == cygself ? info : info->arg);
return 0; return 0;
} }
@ -165,30 +189,43 @@ out:
return info; return info;
} }
cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param, cygthread::cygthread (LPTHREAD_START_ROUTINE start, size_t n, void *param,
const char *name, HANDLE notify) const char *name, HANDLE notify)
: __name (name), func (start), arg (param), notify_detached (notify) : __name (name), func (start), arglen (n), arg (param), notify_detached (notify)
{ {
thread_printf ("name %s, id %p", name, id); thread_printf ("name %s, id %p", name, id);
HANDLE htobe;
if (h) if (h)
{ {
if (ev)
ResetEvent (ev);
while (!thread_sync) while (!thread_sync)
low_priority_sleep (0); low_priority_sleep (0);
SetEvent (thread_sync); SetEvent (thread_sync);
thread_printf ("activated name '%s', thread_sync %p for thread %p", name, thread_sync, id); thread_printf ("activated name '%s', thread_sync %p for thread %p", name, thread_sync, id);
htobe = h;
} }
else else
{ {
stack_ptr = NULL; stack_ptr = NULL;
h = CreateThread (&sec_none_nih, 0, is_freerange ? simplestub : stub, htobe = CreateThread (&sec_none_nih, 0, is_freerange ? simplestub : stub,
this, 0, &id); this, 0, &id);
if (!h) if (!htobe)
api_fatal ("CreateThread failed for %s - %p<%p>, %E", name, h, id); api_fatal ("CreateThread failed for %s - %p<%p>, %E", name, h, id);
thread_printf ("created name '%s', thread %p, id %p", name, h, id); thread_printf ("created name '%s', thread %p, id %p", name, h, id);
#ifdef DEBUGGING #ifdef DEBUGGING
terminated = false; terminated = false;
#endif #endif
} }
if (n)
{
while (!ev)
low_priority_sleep (0);
WaitForSingleObject (ev, INFINITE);
ResetEvent (ev);
}
h = htobe;
} }
/* Return the symbolic name of the current thread for debugging. /* Return the symbolic name of the current thread for debugging.
@ -238,8 +275,6 @@ cygthread::release (bool nuke_h)
#endif #endif
__name = NULL; __name = NULL;
func = NULL; func = NULL;
if (ev)
ResetEvent (ev);
if (!InterlockedExchange (&inuse, 0)) if (!InterlockedExchange (&inuse, 0))
#ifdef DEBUGGING #ifdef DEBUGGING
api_fatal ("released a thread that was not inuse"); api_fatal ("released a thread that was not inuse");

View File

@ -23,6 +23,7 @@ class cygthread
bool terminated; bool terminated;
#endif #endif
LPTHREAD_START_ROUTINE func; LPTHREAD_START_ROUTINE func;
unsigned arglen;
VOID *arg; VOID *arg;
bool is_freerange; bool is_freerange;
static bool exiting; static bool exiting;
@ -33,9 +34,10 @@ class cygthread
static DWORD WINAPI simplestub (VOID *); static DWORD WINAPI simplestub (VOID *);
static DWORD main_thread_id; static DWORD main_thread_id;
static const char * name (DWORD = 0); static const char * name (DWORD = 0);
void callfunc (bool) __attribute__ ((noinline, regparm (2)));
void auto_release () {func = NULL;} void auto_release () {func = NULL;}
void release (bool); void release (bool);
cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *, HANDLE = NULL); cygthread (LPTHREAD_START_ROUTINE, unsigned, LPVOID, const char *, HANDLE = NULL);
cygthread () {}; cygthread () {};
static void init (); static void init ();
bool detach (HANDLE = NULL); bool detach (HANDLE = NULL);

View File

@ -1021,7 +1021,7 @@ do_exit (int status)
} }
#endif #endif
process_lock until_exit (true); lock_process until_exit (true);
if (exit_state < ES_GLOBAL_DTORS) if (exit_state < ES_GLOBAL_DTORS)
{ {

View File

@ -89,7 +89,7 @@ public:
friend class cygheap_fdget; friend class cygheap_fdget;
friend class cygheap_fdnew; friend class cygheap_fdnew;
friend class cygheap_fdenum; friend class cygheap_fdenum;
friend class process_lock; friend class lock_process;
}; };
fhandler_base *build_fh_dev (const device&, const char * = NULL); fhandler_base *build_fh_dev (const device&, const char * = NULL);

View File

@ -1183,7 +1183,7 @@ signal_exit (int rc)
TerminateProcess (hExeced, sigExeced = rc); TerminateProcess (hExeced, sigExeced = rc);
} }
process_lock until_exit (true); lock_process until_exit (true);
if (hExeced || exit_state) if (hExeced || exit_state)
myself.exit (rc); myself.exit (rc);

View File

@ -95,7 +95,7 @@ create_thread_and_wait (int what, PVOID in, PVOID out, DWORD outsize,
{ {
netdriveinf ndi = { what, 0, in, out, outsize, netdriveinf ndi = { what, 0, in, out, outsize,
CreateSemaphore (&sec_none_nih, 0, 2, NULL) }; CreateSemaphore (&sec_none_nih, 0, 2, NULL) };
cygthread *thr = new cygthread (thread_netdrive, (LPVOID) &ndi, name); cygthread *thr = new cygthread (thread_netdrive, 0, &ndi, name);
if (thr->detach (ndi.sem)) if (thr->detach (ndi.sem))
ndi.ret = ERROR_OPERATION_ABORTED; ndi.ret = ERROR_OPERATION_ABORTED;
CloseHandle (ndi.sem); CloseHandle (ndi.sem);

View File

@ -81,15 +81,15 @@ fhandler_tty_master::init ()
set_close_on_exec (true); set_close_on_exec (true);
cygthread *h; cygthread *h;
h = new cygthread (process_input, cygself, "ttyin"); h = new cygthread (process_input, 0, cygself, "ttyin");
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST); h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
h->zap_h (); h->zap_h ();
h = new cygthread (process_ioctl, cygself, "ttyioctl"); h = new cygthread (process_ioctl, 0, cygself, "ttyioctl");
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST); h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
h->zap_h (); h->zap_h ();
h = new cygthread (process_output, cygself, "ttyout"); h = new cygthread (process_output, 0, cygself, "ttyout");
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST); h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
h->zap_h (); h->zap_h ();

View File

@ -139,8 +139,9 @@ pinfo::zap_cwd ()
void void
pinfo::exit (DWORD n) pinfo::exit (DWORD n)
{ {
process_lock until_exit (); lock_process until_exit ();
cygthread::terminate (); cygthread::terminate ();
if (n != EXITCODE_NOSET) if (n != EXITCODE_NOSET)
self->exitcode = EXITCODE_SET | n;/* We're really exiting. Record the UNIX exit code. */ self->exitcode = EXITCODE_SET | n;/* We're really exiting. Record the UNIX exit code. */
else else
@ -378,9 +379,10 @@ _pinfo::alive ()
extern char **__argv; extern char **__argv;
void DWORD WINAPI
_pinfo::commune_process (siginfo_t& si) commune_process (void *arg)
{ {
siginfo_t& si = *((siginfo_t *) arg);
char path[CYG_MAX_PATH]; char path[CYG_MAX_PATH];
DWORD nr; DWORD nr;
HANDLE& tothem = si._si_commune._si_write_handle; 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 if (process_sync) // FIXME: this test shouldn't be necessary
ProtectHandle (process_sync); ProtectHandle (process_sync);
process_lock now (false); lock_process now (false);
switch (si._si_commune._si_code) switch (si._si_commune._si_code)
{ {
@ -546,6 +548,8 @@ _pinfo::commune_process (siginfo_t& si)
ForceCloseHandle (process_sync); ForceCloseHandle (process_sync);
} }
CloseHandle (tothem); CloseHandle (tothem);
_my_tls._ctinfo->auto_release ();
return 0;
} }
commune_result commune_result
@ -587,7 +591,7 @@ _pinfo::commune_request (__uint32_t code, ...)
break; break;
} }
process_lock now (); lock_process now ();
locked = true; locked = true;
char name_buf[CYG_MAX_PATH]; char name_buf[CYG_MAX_PATH];
request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX, request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX,
@ -959,7 +963,7 @@ pinfo::wait ()
waiter_ready = false; waiter_ready = false;
/* Fire up a new thread to track the subprocess */ /* 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) if (!h)
sigproc_printf ("tracking thread creation failed for pid %d", (*this)->pid); sigproc_printf ("tracking thread creation failed for pid %d", (*this)->pid);
else else

View File

@ -105,7 +105,6 @@ public:
sig_mask = mask; sig_mask = mask;
} }
void commune_process (siginfo_t&);
commune_result commune_request (__uint32_t, ...); commune_result commune_request (__uint32_t, ...);
bool alive (); bool alive ();
fhandler_pipe *pipe_fhandler (HANDLE, size_t &); fhandler_pipe *pipe_fhandler (HANDLE, size_t &);
@ -135,6 +134,8 @@ public:
friend class pinfo; friend class pinfo;
}; };
DWORD WINAPI commune_process (void *);
enum parent_alerter enum parent_alerter
{ {
__ALERT_REPARENT = 111, // arbitrary non-signal value __ALERT_REPARENT = 111, // arbitrary non-signal value

View File

@ -181,7 +181,7 @@ fhandler_pipe::read (void *in_ptr, size_t& in_len)
else else
{ {
pipeargs pi = {dynamic_cast<fhandler_base *>(this), in_ptr, &in_len}; pipeargs pi = {dynamic_cast<fhandler_base *>(this), in_ptr, &in_len};
cygthread *th = new cygthread (read_pipe, &pi, "read_pipe"); cygthread *th = new cygthread (read_pipe, 0, &pi, "read_pipe");
if (th->detach (read_state) && !in_len) if (th->detach (read_state) && !in_len)
in_len = (size_t) -1; /* received a signal */ in_len = (size_t) -1; /* received a signal */
} }
@ -236,7 +236,6 @@ fhandler_pipe::fixup_after_exec ()
void void
fhandler_pipe::fixup_after_fork (HANDLE parent) fhandler_pipe::fixup_after_fork (HANDLE parent)
{ {
debug_printf ("here");
fhandler_base::fixup_after_fork (parent); fhandler_base::fixup_after_fork (parent);
if (guard) if (guard)
fork_fixup (parent, guard, "guard"); fork_fixup (parent, guard, "guard");

View File

@ -662,7 +662,7 @@ start_thread_pipe (select_record *me, select_stuff *stuff)
pipeinf *pi = new pipeinf; pipeinf *pi = new pipeinf;
pi->start = &stuff->start; pi->start = &stuff->start;
pi->stop_thread_pipe = false; pi->stop_thread_pipe = false;
pi->thread = new cygthread (thread_pipe, (LPVOID) pi, "select_pipe"); pi->thread = new cygthread (thread_pipe, 0, pi, "select_pipe");
me->h = *pi->thread; me->h = *pi->thread;
if (!me->h) if (!me->h)
return 0; return 0;
@ -1091,7 +1091,7 @@ start_thread_serial (select_record *me, select_stuff *stuff)
serialinf *si = new serialinf; serialinf *si = new serialinf;
si->start = &stuff->start; si->start = &stuff->start;
si->stop_thread_serial = false; si->stop_thread_serial = false;
si->thread = new cygthread (thread_serial, (LPVOID) si, "select_serial"); si->thread = new cygthread (thread_serial, 0, si, "select_serial");
me->h = *si->thread; me->h = *si->thread;
stuff->device_specific_serial = (void *) si; stuff->device_specific_serial = (void *) si;
return 1; return 1;
@ -1422,7 +1422,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
stuff->device_specific_socket = (void *) si; stuff->device_specific_socket = (void *) si;
si->start = &stuff->start; si->start = &stuff->start;
select_printf ("stuff_start %p", &stuff->start); select_printf ("stuff_start %p", &stuff->start);
si->thread = new cygthread (thread_socket, (LPVOID) si, "select_socket"); si->thread = new cygthread (thread_socket, 0, si, "select_socket");
me->h = *si->thread; me->h = *si->thread;
return 1; return 1;
@ -1674,7 +1674,7 @@ start_thread_mailslot (select_record *me, select_stuff *stuff)
mailslotinf *mi = new mailslotinf; mailslotinf *mi = new mailslotinf;
mi->start = &stuff->start; mi->start = &stuff->start;
mi->stop_thread_mailslot = false; mi->stop_thread_mailslot = false;
mi->thread = new cygthread (thread_mailslot, (LPVOID) mi, "select_mailslot"); mi->thread = new cygthread (thread_mailslot, 0, mi, "select_mailslot");
me->h = *mi->thread; me->h = *mi->thread;
if (!me->h) if (!me->h)
return 0; return 0;

View File

@ -481,7 +481,7 @@ sigproc_init ()
sync_proc_subproc.init ("sync_proc_subproc"); sync_proc_subproc.init ("sync_proc_subproc");
my_sendsig = INVALID_HANDLE_VALUE; // changed later my_sendsig = INVALID_HANDLE_VALUE; // changed later
cygthread *hwait_sig = new cygthread (wait_sig, cygself, "sig"); cygthread *hwait_sig = new cygthread (wait_sig, 0, cygself, "sig");
hwait_sig->zap_h (); hwait_sig->zap_h ();
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER; global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
@ -816,36 +816,44 @@ child_info::ready (bool execed)
} }
bool bool
child_info::sync (pid_t pid, HANDLE hProcess, DWORD howlong) child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong)
{ {
if (!subproc_ready)
{
sigproc_printf ("not waiting. subproc_ready is NULL");
return false;
}
HANDLE w4[2];
w4[0] = subproc_ready;
w4[1] = hProcess;
bool res; bool res;
sigproc_printf ("waiting for subproc_ready(%p) and child process(%p)", w4[0], w4[1]); if (!subproc_ready && !myself->wr_proc_pipe)
switch (WaitForMultipleObjects (2, w4, FALSE, howlong)) res = false;
else
{ {
case WAIT_OBJECT_0: HANDLE w4[2];
sigproc_printf ("got subproc_ready for pid %d", pid); unsigned n = 0;
res = true; unsigned nsubproc_ready;
break;
case WAIT_OBJECT_0 + 1: if (!subproc_ready)
sigproc_printf ("process exited before subproc_ready"); nsubproc_ready = WAIT_OBJECT_0 + 3;
if (WaitForSingleObject (subproc_ready, 0) == WAIT_OBJECT_0) else
sigproc_printf ("should never happen. noticed subproc_ready after process exit"); {
res = false; w4[n++] = subproc_ready;
break; nsubproc_ready = 0;
default: }
system_printf ("wait failed, pid %d, %E", pid); w4[n++] = hProcess;
res = false;
break; sigproc_printf ("waiting for subproc_ready(%p) and child process(%p)", w4[0], w4[1]);
DWORD x = WaitForMultipleObjects (n, w4, FALSE, howlong);
x -= WAIT_OBJECT_0;
if (x >= n)
{
system_printf ("wait failed, pid %d, %E", pid);
res = false;
}
else
{
if (n == nsubproc_ready)
{
CloseHandle (hProcess);
hProcess = NULL;
}
sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x);
res = true;
}
} }
return res; return res;
} }
@ -968,25 +976,28 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child)
} }
static void static void
talktome (siginfo_t& si, HANDLE readsig) talktome (siginfo_t *si, HANDLE readsig)
{ {
sigproc_printf ("pid %d wants some information", si.si_pid); unsigned size = sizeof (*si);
pinfo pi (si.si_pid); sigproc_printf ("pid %d wants some information", si->si_pid);
sigproc_printf ("pid %d pi %p", si.si_pid, (_pinfo *) pi); // DELETEME if (si->_si_commune._si_code & PICOM_EXTRASTR)
if (si._si_commune._si_code & PICOM_EXTRASTR)
{ {
size_t n; size_t n;
DWORD nb; DWORD nb;
if (!ReadFile (readsig, &n, sizeof (n), &nb, NULL) || nb != sizeof (n)) if (!ReadFile (readsig, &n, sizeof (n), &nb, NULL) || nb != sizeof (n))
return; return;
// FIXME: Is alloca here? siginfo_t *newsi = (siginfo_t *) alloca (size += n + 1);
si._si_commune._si_str = (char *) alloca (n + 1); *newsi = *si;
if (!ReadFile (readsig, si._si_commune._si_str, n, &nb, NULL) || nb != n) newsi->_si_commune._si_str = (char *) (newsi + 1);
if (!ReadFile (readsig, newsi->_si_commune._si_str, n, &nb, NULL) || nb != n)
return; return;
si._si_commune._si_str[n] = '\0'; newsi->_si_commune._si_str[n] = '\0';
si = newsi;
} }
pinfo pi (si->si_pid);
if (pi) if (pi)
pi->commune_process (si); new cygthread (commune_process, size, si, "commune_process");
} }
void void
@ -1100,7 +1111,7 @@ wait_sig (VOID *)
switch (pack.si.si_signo) switch (pack.si.si_signo)
{ {
case __SIGCOMMUNE: case __SIGCOMMUNE:
talktome (pack.si, readsig); talktome (&pack.si, readsig);
break; break;
case __SIGSTRACE: case __SIGSTRACE:
strace.hello (); strace.hello ();

View File

@ -814,11 +814,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
switch (mode) switch (mode)
{ {
case _P_OVERLAY: case _P_OVERLAY:
if (!synced) if (!synced && !myself->wr_proc_pipe)
/* let myself.exit handle this */;
else if (myself->wr_proc_pipe)
myself.hProcess = NULL;
else
{ {
extern bool is_toplevel_proc; extern bool is_toplevel_proc;
is_toplevel_proc = true; is_toplevel_proc = true;

View File

@ -245,7 +245,7 @@ timer_tracker::settime (int in_flags, const itimerspec *value, itimerspec *ovalu
syncthread = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); syncthread = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
else else
ResetEvent (syncthread); ResetEvent (syncthread);
new cygthread (timer_thread, this, "itimer", syncthread); new cygthread (timer_thread, 0, this, "itimer", syncthread);
} }
return 0; return 0;

View File

@ -118,7 +118,7 @@ HWND ()
if (!hwnd) if (!hwnd)
{ {
_lock.upforgrabs (); _lock.upforgrabs ();
cygthread *h = new cygthread (::winthread, this, "win"); cygthread *h = new cygthread (::winthread, 0, this, "win");
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST); h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
h->zap_h (); h->zap_h ();
lock (); lock ();