* sigproc.cc (exit_thread): undef ExitThread or suffer recursion. Attempt to
lock process prior to calling sig_send.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | ||||
| 2012-12-21  Christopher Faylor  <me.cygwin2012@cgf.cx> | ||||
|  | ||||
| 	* sigproc.cc (exit_thread): undef ExitThread or suffer recursion. | ||||
| 	Attempt to lock process prior to calling sig_send. | ||||
|  | ||||
| 2012-12-21  Christopher Faylor  <me.cygwin2012@cgf.cx> | ||||
|  | ||||
| 	Revert the reversion and go with implementation described in | ||||
|   | ||||
| @@ -561,6 +561,8 @@ exit_thread (DWORD res) | ||||
| { | ||||
|   HANDLE h; | ||||
|  | ||||
| # undef ExitThread | ||||
|  | ||||
|   if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | ||||
|                         GetCurrentProcess (), &h, | ||||
|                         0, FALSE, DUPLICATE_SAME_ACCESS)) | ||||
| @@ -573,10 +575,10 @@ exit_thread (DWORD res) | ||||
|   ProtectHandle1 (h, exit_thread); | ||||
|   siginfo_t si = {__SIGTHREADEXIT, SI_KERNEL}; | ||||
|   si.si_value.sival_ptr = h; | ||||
|   lock_process for_now;		/* May block indefinitely if we're exiting. */ | ||||
|   /* Tell wait_sig to wait for this thread to exit.  It can then release | ||||
|      the lock below and close the above-opened handle. */ | ||||
|   sig_send (myself_nowait, si, &_my_tls); | ||||
|   lock_process for_now; | ||||
|   ExitThread (0);		/* Should never hit this */ | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -48,9 +48,9 @@ class lock_process | ||||
| public: | ||||
|   static void init () {locker.init ("lock_process");} | ||||
|   void dont_bother () {skip_unlock = true;} | ||||
|   lock_process (bool exiting = false) | ||||
|   lock_process (bool exiting = false, DWORD howlong = INFINITE) | ||||
|   { | ||||
|     locker.acquire (); | ||||
|     locker.acquire (howlong); | ||||
|     skip_unlock = exiting; | ||||
|     if (exiting && exit_state < ES_PROCESS_LOCKED) | ||||
|       exit_state = ES_PROCESS_LOCKED; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user