summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/exceptions.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-11 00:25:57 +0000
committerChristopher Faylor <me@cgf.cx>2000-09-11 00:25:57 +0000
commit9149d76e50da76800d4394b1c8a7478ceeed94fa (patch)
tree28f08de5572be452a045fb48f73fdf8861c1fa90 /winsup/cygwin/exceptions.cc
parent10e1fce6a1122737578402681e0a522da6dfa7f2 (diff)
downloadcygnal-9149d76e50da76800d4394b1c8a7478ceeed94fa.tar.gz
cygnal-9149d76e50da76800d4394b1c8a7478ceeed94fa.tar.bz2
cygnal-9149d76e50da76800d4394b1c8a7478ceeed94fa.zip
* cygheap.cc (init_cheap): Just use any old address for the cygwin heap.
* exceptions.cc (signal_exit): Don't terminate the main thread. Just try to exit in this thread really quickly. * signal.cc (kill_pgrp): Fix typo which caused pinfo structure to be assigned incorrectly.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 16b845038..e71c4a7b1 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -992,11 +992,6 @@ exit_sig:
sig |= 0x80;
}
sigproc_printf ("signal %d, about to call do_exit", sig);
- TerminateThread (hMainThread, 0);
- /* FIXME: This just works around the problem so that we don't attempt to
- use a resource lock when exiting. */
- user_data->resourcelocks->Delete ();
- user_data->resourcelocks->Init ();
signal_exit (sig);
/* Never returns */
}
@@ -1007,15 +1002,6 @@ exit_sig:
static void
signal_exit (int rc)
{
- /* If the exception handler gets a trap, we could recurse awhile.
- If this is non-zero, skip the cleaning up and exit NOW. */
-
- muto *m;
- /* FIXME: Make multi-thread aware */
- for (m = muto_start.next; m != NULL; m = m->next)
- if (m->unstable () || m->owner () == mainthread.id)
- m->reset ();
-
rc = EXIT_SIGNAL | (rc << 8);
if (exit_already++)
{
@@ -1024,6 +1010,20 @@ signal_exit (int rc)
ExitProcess (rc);
}
+ /* We'd like to stop the main thread from executing but when we do that it
+ causes random, inexplicable hangs. So, instead, we set up the priority
+ of this thread really high so that it should do its thing and then exit. */
+ (void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
+
+ /* Unlock any main thread mutos since we're executing with prejudice. */
+ muto *m;
+ for (m = muto_start.next; m != NULL; m = m->next)
+ if (m->unstable () || m->owner () == mainthread.id)
+ m->reset ();
+
+ user_data->resourcelocks->Delete ();
+ user_data->resourcelocks->Init ();
+
do_exit (rc);
}