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>2012-12-22 07:14:37 +0400
committerChristopher Faylor <me@cgf.cx>2012-12-22 07:14:37 +0400
commitd3a03427bc2f8b17b7e87c07ba318f6a1df9dd70 (patch)
tree1a74ae6d916d447b12807042151e79141c79e095 /winsup/cygwin
parentc3a4634985018ad5e1e1d972ff3799254e0b88aa (diff)
* sigproc.cc (exit_thread): undef ExitThread or suffer recursion. Attempt to
lock process prior to calling sig_send.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/sigproc.cc6
-rw-r--r--winsup/cygwin/sync.h4
3 files changed, 11 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7f3822f5d..7a47897ba 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
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
cgf-000017, with some modifications.
* init.cc (dll_entry): Revert previous change.
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index be89d8685..33fbb3a00 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -561,6 +561,8 @@ exit_thread (DWORD res)
{
HANDLE h;
+# undef ExitThread
+
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
GetCurrentProcess (), &h,
0, FALSE, DUPLICATE_SAME_ACCESS))
@@ -573,11 +575,11 @@ 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 */
+ ExitThread (0); /* Should never hit this */
}
int __stdcall
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h
index d424d39ab..2afa1199e 100644
--- a/winsup/cygwin/sync.h
+++ b/winsup/cygwin/sync.h
@@ -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;