* cygtls.h (_cygtls::interrupt_now): Subsume interruptible().

(interruptible): Delete.
(setup_handler): Remove interruptible call and just use return from
interrupt_now.
This commit is contained in:
Christopher Faylor 2005-12-20 00:31:50 +00:00
parent 7a01aa546d
commit 98da134d62
2 changed files with 27 additions and 18 deletions

View File

@ -1,3 +1,10 @@
2005-12-19 Christopher Faylor <cgf@timesys.com>
* cygtls.h (_cygtls::interrupt_now): Subsume interruptible().
(interruptible): Delete.
(setup_handler): Remove interruptible call and just use return from
interrupt_now.
2005-12-19 Christopher Faylor <cgf@timesys.com>
* fhandler.h (set_console_state_for_spawn): Add an argument to the

View File

@ -659,14 +659,16 @@ sig_handle_tty_stop (int sig)
}
bool
interruptible (DWORD pc)
_cygtls::interrupt_now (CONTEXT *cx, int sig, void *handler,
struct sigaction& siga)
{
int res;
bool interrupted;
MEMORY_BASIC_INFORMATION m;
memset (&m, 0, sizeof m);
if (!VirtualQuery ((LPCVOID) pc, &m, sizeof m))
sigproc_printf ("couldn't get memory info, pc %p, %E", pc);
if (!VirtualQuery ((LPCVOID) cx->Eip, &m, sizeof m))
sigproc_printf ("couldn't get memory info, pc %p, %E", cx->Eip);
char *checkdir = (char *) alloca (windows_system_directory_length + 4);
memset (checkdir, 0, sizeof (checkdir));
@ -684,10 +686,22 @@ interruptible (DWORD pc)
else
res = !strncasematch (windows_system_directory, checkdir,
windows_system_directory_length);
sigproc_printf ("pc %p, h %p, interruptible %d", pc, h, res);
sigproc_printf ("pc %p, h %p, interruptible %d", cx->Eip, h, res);
# undef h
return res;
if (!res || (incyg || spinning || locked ()))
interrupted = false;
else
{
push ((__stack_t) cx->Eip);
interrupt_setup (sig, handler, siga);
cx->Eip = pop ();
SetThreadContext (*this, cx); /* Restart the thread in a new location */
interrupted = true;
}
return interrupted;
}
void __stdcall
_cygtls::interrupt_setup (int sig, void *handler, struct sigaction& siga)
{
@ -711,17 +725,6 @@ _cygtls::interrupt_setup (int sig, void *handler, struct sigaction& siga)
sig, res);
}
bool
_cygtls::interrupt_now (CONTEXT *ctx, int sig, void *handler,
struct sigaction& siga)
{
push ((__stack_t) ctx->Eip);
interrupt_setup (sig, handler, siga);
ctx->Eip = pop ();
SetThreadContext (*this, ctx); /* Restart the thread in a new location */
return 1;
}
extern "C" void __stdcall
set_sig_errno (int e)
{
@ -789,8 +792,7 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls)
cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
if (!GetThreadContext (hth, &cx))
system_printf ("couldn't get context of main thread, %E");
else if (interruptible (cx.Eip) &&
!(tls->incyg || tls->spinning || tls->locked ()))
else
interrupted = tls->interrupt_now (&cx, sig, handler, siga);
res = ResumeThread (hth);