* dcrt0.cc (sigthread::init): Correct overzealous ifdef.
* exceptions.cc (call_handler): Avoid calling sigthread acquire lock. * sigproc.h (sigthread): Comment out lock for now. * sync.cc (muto::acquire): Add a minor optimization.
This commit is contained in:
		| @@ -1,3 +1,10 @@ | |||||||
|  | Thu Oct 19 13:55:31 2000  Christopher Faylor <cgf@cygnus.com> | ||||||
|  |  | ||||||
|  | 	* dcrt0.cc (sigthread::init): Correct overzealous ifdef. | ||||||
|  | 	* exceptions.cc (call_handler): Avoid calling sigthread acquire lock. | ||||||
|  | 	* sigproc.h (sigthread): Comment out lock for now. | ||||||
|  | 	* sync.cc (muto::acquire): Add a minor optimization. | ||||||
|  |  | ||||||
| 2000-10-18  DJ Delorie  <dj@redhat.com> | 2000-10-18  DJ Delorie  <dj@redhat.com> | ||||||
|  |  | ||||||
| 	* Makefile.in: add miscfuncs.cc | 	* Makefile.in: add miscfuncs.cc | ||||||
|   | |||||||
| @@ -616,8 +616,8 @@ sigthread::init (const char *s) | |||||||
| { | { | ||||||
| #if 0 /* FIXME: Someday we'll need this for inter-thread signalling */ | #if 0 /* FIXME: Someday we'll need this for inter-thread signalling */ | ||||||
|   lock = new_muto (FALSE, s); |   lock = new_muto (FALSE, s); | ||||||
|   id = GetCurrentThreadId (); |  | ||||||
| #endif | #endif | ||||||
|  |   id = GetCurrentThreadId (); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Take over from libc's crt0.o and start the application. Note the | /* Take over from libc's crt0.o and start the application. Note the | ||||||
|   | |||||||
| @@ -709,7 +709,9 @@ call_handler (int sig, struct sigaction& siga, void *handler) | |||||||
|   int res; |   int res; | ||||||
|   int using_mainthread_frame; |   int using_mainthread_frame; | ||||||
|  |  | ||||||
|  | #if 0 | ||||||
|   mainthread.lock->acquire (); |   mainthread.lock->acquire (); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   if (sigsave.sig) |   if (sigsave.sig) | ||||||
|     goto set_pending; |     goto set_pending; | ||||||
| @@ -723,7 +725,9 @@ call_handler (int sig, struct sigaction& siga, void *handler) | |||||||
|     { |     { | ||||||
|       int i; |       int i; | ||||||
|       using_mainthread_frame = 0; |       using_mainthread_frame = 0; | ||||||
|  | #if 0 | ||||||
|       mainthread.lock->release (); |       mainthread.lock->release (); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|       hth = myself->getthread2signal (); |       hth = myself->getthread2signal (); | ||||||
|       /* Suspend the thread which will receive the signal.  But first ensure that |       /* Suspend the thread which will receive the signal.  But first ensure that | ||||||
| @@ -747,14 +751,18 @@ call_handler (int sig, struct sigaction& siga, void *handler) | |||||||
| 	    if (m->unstable () || m->owner () == mainthread.id) | 	    if (m->unstable () || m->owner () == mainthread.id) | ||||||
| 	      goto owns_muto; | 	      goto owns_muto; | ||||||
|  |  | ||||||
|  | #if 0 | ||||||
| 	  mainthread.lock->acquire (); | 	  mainthread.lock->acquire (); | ||||||
|  | #endif | ||||||
| 	  if (mainthread.frame) | 	  if (mainthread.frame) | ||||||
| 	    { | 	    { | ||||||
| 	      ebp = mainthread.frame;	/* try to avoid a race */ | 	      ebp = mainthread.frame;	/* try to avoid a race */ | ||||||
| 	      using_mainthread_frame = 1; | 	      using_mainthread_frame = 1; | ||||||
| 	      goto next; | 	      goto next; | ||||||
| 	    } | 	    } | ||||||
|  | #if 0 | ||||||
| 	  mainthread.lock->release (); | 	  mainthread.lock->release (); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| 	  cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER; | 	  cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER; | ||||||
| 	  if (!GetThreadContext (hth, &cx)) | 	  if (!GetThreadContext (hth, &cx)) | ||||||
| @@ -816,7 +824,9 @@ out: | |||||||
|       sigproc_printf ("ResumeThread returned %d", res); |       sigproc_printf ("ResumeThread returned %d", res); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | #if 0 | ||||||
|   mainthread.lock->release (); |   mainthread.lock->release (); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   sigproc_printf ("returning %d", interrupted); |   sigproc_printf ("returning %d", interrupted); | ||||||
|   return interrupted; |   return interrupted; | ||||||
|   | |||||||
| @@ -38,7 +38,9 @@ struct sigthread | |||||||
| { | { | ||||||
|   DWORD id; |   DWORD id; | ||||||
|   DWORD frame; |   DWORD frame; | ||||||
|  | #if 0 | ||||||
|   muto *lock;			// FIXME: Use for multi-thread signalling someday |   muto *lock;			// FIXME: Use for multi-thread signalling someday | ||||||
|  | #endif | ||||||
|   void init (const char *s); |   void init (const char *s); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -87,7 +87,7 @@ muto::acquire (DWORD ms) | |||||||
| 	  switch (WaitForSingleObject (bruteforce, ms)) | 	  switch (WaitForSingleObject (bruteforce, ms)) | ||||||
| 	      { | 	      { | ||||||
| 	      case WAIT_OBJECT_0: | 	      case WAIT_OBJECT_0: | ||||||
| 		was_waiting = 0; | 		goto gotit; | ||||||
| 		break; | 		break; | ||||||
| 	      default: | 	      default: | ||||||
| 		InterlockedDecrement (&waiters); | 		InterlockedDecrement (&waiters); | ||||||
| @@ -96,6 +96,7 @@ muto::acquire (DWORD ms) | |||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | gotit: | ||||||
|   tid = this_tid;	/* register this thread. */ |   tid = this_tid;	/* register this thread. */ | ||||||
|   return ++visits;	/* Increment visit count. */ |   return ++visits;	/* Increment visit count. */ | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user