]> sourceware.org Git - newlib-cygwin.git/commitdiff
* cygtls.h (_cygtls::handle_threadlist_exception): Eliminate.
authorChristopher Faylor <me@cgf.cx>
Sat, 1 Mar 2008 14:53:44 +0000 (14:53 +0000)
committerChristopher Faylor <me@cgf.cx>
Sat, 1 Mar 2008 14:53:44 +0000 (14:53 +0000)
(_cygtls::init_threadlist_exceptions): Ditto.
* cygtls.cc (_cygtls::handle_threadlist_exception): Eliminate.
(_cygtls::init_threadlist_exceptions): Ditto.
(_cygtls::find_tls): Use myfault handling to deal with errors caused by
nonexistent threads.

winsup/cygwin/ChangeLog
winsup/cygwin/cygtls.cc
winsup/cygwin/cygtls.h
winsup/cygwin/sigproc.cc

index 0a3ef43bf07b3998da1f7322ffedfee8a207452b..3963e0bf5e624bb7cb155ff827dd90e5424c73f2 100644 (file)
@@ -1,3 +1,12 @@
+2008-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * cygtls.h (_cygtls::handle_threadlist_exception): Eliminate.
+       (_cygtls::init_threadlist_exceptions): Ditto.
+       * cygtls.cc (_cygtls::handle_threadlist_exception): Eliminate.
+       (_cygtls::init_threadlist_exceptions): Ditto.
+       (_cygtls::find_tls): Use myfault handling to deal with errors caused by
+       nonexistent threads.
+
 2008-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
 
        * cygtls.cc (_cygtls::init_exception_handler): Just return.
index 34ba149345586696042f5206413464c801121ed5..bb6e5a64348f0c43d05daf69002f2d58c8c284f8 100644 (file)
@@ -195,23 +195,28 @@ _cygtls::push (__stack_t addr)
   *stackptr++ = (__stack_t) addr;
 }
 
-#define BAD_IX ((size_t) -1)
-static size_t NO_COPY threadlist_ix = BAD_IX;
 
 _cygtls *
 _cygtls::find_tls (int sig)
 {
+  static int NO_COPY threadlist_ix;
+
   debug_printf ("sig %d\n", sig);
   sentry here (INFINITE);
-  __asm__ volatile (".equ _threadlist_exception_return,.");
+
   _cygtls *res = NULL;
-  for (threadlist_ix = 0; threadlist_ix < nthreads; threadlist_ix++)
+  threadlist_ix = -1;
+
+  myfault efault;
+  if (efault.faulted ())
+    cygheap->threadlist[threadlist_ix]->remove (INFINITE);
+
+  while (++threadlist_ix < (int) nthreads)
     if (sigismember (&(cygheap->threadlist[threadlist_ix]->sigwait_mask), sig))
       {
        res = cygheap->threadlist[threadlist_ix];
        break;
       }
-  threadlist_ix = BAD_IX;
   return res;
 }
 
@@ -221,35 +226,6 @@ _cygtls::set_siginfo (sigpacket *pack)
   infodata = pack->si;
 }
 
-extern "C" DWORD __stdcall RtlUnwind (void *, void *, void *, DWORD) __attribute__ ((noreturn));
-int
-_cygtls::handle_threadlist_exception (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *c, void *)
-{
-  if (e->ExceptionCode != STATUS_ACCESS_VIOLATION)
-    {
-      system_printf ("unhandled exception %p at %p", e->ExceptionCode, c->Eip);
-      return 1;
-    }
-
-  sentry here;
-  if (threadlist_ix == BAD_IX)
-    {
-      api_fatal ("called with threadlist_ix %d", BAD_IX);
-      return 1;
-    }
-
-  if (!here.acquired ())
-    {
-      system_printf ("couldn't aquire muto");
-      return 1;
-    }
-
-  extern void *threadlist_exception_return;
-  cygheap->threadlist[threadlist_ix]->remove (INFINITE);
-  threadlist_ix = 0;
-  return 0;
-}
-
 /* Set up the exception handler for the current thread.  The x86 uses segment
    register fs, offset 0 to point to the current exception handler. */
 
@@ -273,9 +249,3 @@ _cygtls::init_exception_handler (exception_handler *eh)
   el.prev = _except_list;
   _except_list = &el;
 }
-
-void
-_cygtls::init_threadlist_exceptions ()
-{
-  init_exception_handler (handle_threadlist_exception);
-}
index 7e584f6fc88a93960a8cd8eee84933ab1485120f..14ccffd41f34bbb5bb5d2ac2b3fc61449acc4e7e 100644 (file)
@@ -190,10 +190,8 @@ struct _cygtls
 
   /* exception handling */
   static int handle_exceptions (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *);
-  static int handle_threadlist_exception (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *);
   bool inside_kernel (CONTEXT *);
   void init_exception_handler (int (*) (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void*));
-  void init_threadlist_exceptions ();
   void signal_exit (int) __attribute__ ((noreturn, regparm(2)));
   void copy_context (CONTEXT *) __attribute__ ((regparm(2)));
   void signal_debugger (int) __attribute__ ((regparm(2)));
index a6d8fed17ba609046c145a08e71dafc2a3e62739..af2b023d7a470d9d1993b75383c852e2e69647e6 100644 (file)
@@ -1166,7 +1166,6 @@ wait_sig (VOID *)
   SetEvent (wait_sig_inited);
 
   _sig_tls = &_my_tls;
-  _sig_tls->init_threadlist_exceptions ();
   sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
                  my_readsig, my_sendsig);
 
This page took 0.036562 seconds and 5 git commands to generate.