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>2004-02-09 07:04:24 +0300
committerChristopher Faylor <me@cgf.cx>2004-02-09 07:04:24 +0300
commitcec4879206f2158d19eccdf5395b551da7c22cb3 (patch)
tree9360159e144fab21242d60375653ef2def3206ef /winsup/cygwin/exceptions.cc
parent733309f5761d777a61b8db86e734fbffc236f104 (diff)
* debug.h (console_printf): Define for non-debugging condition.
* cygtls.h (_threadinfo::lock): Remove wait argument. (_threadinfo::interrupt_setup): Remove retaddr argument. * exceptions.cc (_threadinfo::interrupt_setup): Ditto. (_threadinfo::interrupt_now): Accommodate change to interrupt_setup argument. (setup_handler): Ditto. Always lock sig stack prior to determining interrupt method. * gendef (_sigfe): Correct thinko regarding cmpxchg. (_sigbe): Ditto. (_threadinfo::lock): Ditto. (_threadinfo::pop): Eliminate left-over stack unlock. * sigproc.cc (proc_subproc): Chnage debugging output to printed warning.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index e90d093a2..03df67f10 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -693,9 +693,8 @@ interruptible (DWORD pc)
}
void __stdcall
_threadinfo::interrupt_setup (int sig, void *handler,
- struct sigaction& siga, __stack_t retaddr)
+ struct sigaction& siga)
{
- __stack_t *retaddr_in_tls = stackptr - 1;
push ((__stack_t) sigdelayed);
oldmask = myself->getsigmask ();
newmask = oldmask | siga.sa_mask | SIGTOMASK (sig);
@@ -707,8 +706,9 @@ _threadinfo::interrupt_setup (int sig, void *handler,
myself->stopsig = 0;
myself->process_state |= PID_STOPPED;
}
- this->sig = sig; // Should ALWAYS be second to last setting set to avoid a race
- *retaddr_in_tls = retaddr;
+
+ this->sig = sig; // Should ALWAYS be last setting set to avoid a race
+
/* Clear any waiting threads prior to dispatching to handler function */
int res = SetEvent (signal_arrived); // For an EINTR case
proc_subproc (PROC_CLEARWAIT, 1);
@@ -720,8 +720,8 @@ bool
_threadinfo::interrupt_now (CONTEXT *ctx, int sig, void *handler,
struct sigaction& siga)
{
- push (0);
- interrupt_setup (sig, handler, siga, (__stack_t) ctx->Eip);
+ 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;
@@ -762,20 +762,16 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _threadinfo *tls)
goto out;
}
+ int locked;
for (int i = 0; i < CALL_HANDLER_RETRY; i++)
{
+ locked = tls->lock ();
__stack_t *retaddr_on_stack = tls->stackptr - 1;
if (retaddr_on_stack >= tls->stack)
{
- if (!tls->lock (false))
- continue;
- __stack_t retaddr = InterlockedExchange ((LONG *) retaddr_on_stack, 0);
- if (!retaddr)
- continue;
tls->reset_exception ();
- tls->interrupt_setup (sig, handler, siga, retaddr);
+ tls->interrupt_setup (sig, handler, siga);
sigproc_printf ("interrupted known cygwin routine");
- tls->unlock ();
interrupted = true;
break;
}
@@ -826,11 +822,15 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _threadinfo *tls)
if (interrupted)
break;
+ tls->unlock ();
+ locked = false;
sigproc_printf ("couldn't interrupt. trying again.");
low_priority_sleep (0);
}
out:
+ if (locked)
+ tls->unlock ();
sigproc_printf ("signal %d %sdelivered", sig, interrupted ? "" : "not ");
return interrupted;
}