* exceptions.cc (setup_handler): Add debugging output. Set thread priority to

idle if pending signals to allow other threads to get into interruptible state.
* miscfuncs.cc (sys_mbstowcs): Save current thread in variable to avoid an OS
call.
* wait.cc (wait_sig): Reset thread priority each time through loop since the
priority may have been set down to deal with pending signals.
This commit is contained in:
Christopher Faylor 2002-11-15 04:35:13 +00:00
parent d4990113a1
commit 6597785dc2
5 changed files with 27 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2002-11-14 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (setup_handler): Add debugging output. Set thread
priority to idle if pending signals to allow other threads to get into
interruptible state.
* miscfuncs.cc (sys_mbstowcs): Save current thread in variable to avoid
an OS call.
* wait.cc (wait_sig): Reset thread priority each time through loop
since the priority may have been set down to deal with pending signals.
2002-11-14 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::tcgetattr): Don't take any

View File

@ -637,7 +637,7 @@ interruptible (DWORD pc, int testvalid = 0)
# define h ((HMODULE) m.AllocationBase)
/* Apparently Windows 95 can sometimes return bogus addresses from
GetThreadContext. These resolve to an allocation base == 0.
GetThreadContext. These resolve to a strange allocation base.
These should *never* be treated as interruptible. */
if (!h || m.State != MEM_COMMIT)
res = 0;
@ -866,7 +866,13 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
LeaveCriticalSection (&th->lock);
}
else if (interruptible (cx.Eip))
interrupted = interrupt_now (&cx, sig, handler, siga);
{
interrupted = interrupt_now (&cx, sig, handler, siga);
#ifdef DEBUGGING
if (!interrupted)
sigproc_printf ("couldn't deliver signal %d via %p", sig, cx.Eip);
#endif
}
else
break;
}
@ -892,6 +898,8 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
}
sigproc_printf ("returning %d", interrupted);
if (pending_signals)
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
return interrupted;
}
#endif /* i386 */

View File

@ -1556,9 +1556,7 @@ fhandler_console::write (const void *vsrc, size_t len)
src++;
}
else if (isalpha (*src))
{
dev_state->state_ = gotcommand;
}
dev_state->state_ = gotcommand;
else if (*src != '@' && !isalpha (*src) && !isdigit (*src))
{
if (*src == '?')

View File

@ -1,6 +1,6 @@
/* miscfuncs.cc: misc funcs that don't belong anywhere else
Copyright 1996, 1997, 1998, 1999, 2000 Red Hat, Inc.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@ -295,8 +295,9 @@ sys_mbstowcs (WCHAR *tgt, const char *src, int len)
void __stdcall
low_priority_sleep (DWORD secs)
{
DWORD prio = GetThreadPriority (GetCurrentThread ());
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
HANDLE thisthread = GetCurrentThread ();
int curr_prio = GetThreadPriority (thisthread);
SetThreadPriority (thisthread, THREAD_PRIORITY_IDLE);
Sleep (secs);
SetThreadPriority (GetCurrentThread (), prio);
SetThreadPriority (thisthread, curr_prio);
}

View File

@ -1096,6 +1096,7 @@ wait_sig (VOID *self)
for (;;)
{
DWORD rc = WaitForMultipleObjects (3, catchem, FALSE, sig_loop_wait);
(void) SetThreadPriority (GetCurrentThread (), WAIT_SIG_PRIORITY);
/* sigproc_terminate sets sig_loop_wait to zero to indicate that
* this thread should terminate.