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-12-20 03:31:50 +0300
committerChristopher Faylor <me@cgf.cx>2005-12-20 03:31:50 +0300
commit98da134d62d0b13840a356fcb7eab1bca8be5349 (patch)
treede2f896496891f2b536ef2756b340fa31d80b8c7
parent7a01aa546d49d670cb4c286752522850a81a2ccd (diff)
* cygtls.h (_cygtls::interrupt_now): Subsume interruptible().
(interruptible): Delete. (setup_handler): Remove interruptible call and just use return from interrupt_now.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/exceptions.cc38
2 files changed, 27 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8ccb37483..5a383ea18 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
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
declaration.
* fhandler_console.cc (set_console_state_for_spawn): Ditto for the
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 9b989ee9e..46c742b21 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -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);