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>2003-02-07 18:00:57 +0300
committerChristopher Faylor <me@cgf.cx>2003-02-07 18:00:57 +0300
commit49b84ce441ac48b9e582bc3af96496070d132bec (patch)
tree9ef0444b78437e6506a479fe0e61468a30f0e633
parentbc5b63edab6415566ae8085c10014312d722b0dd (diff)
Christopher Faylor <cgf@redhat.com>
* exceptions.cc (try_to_debug): Set priority of current thread rather than the main thread. Make busy waiting loop less busy. Restore priority when function returns.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/exceptions.cc11
2 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 72f47f442..c68fdfdc5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-07 Vaclav Haisman <V.Haisman@sh.cvut.cz>
+ Christopher Faylor <cgf@redhat.com>
+
+ * exceptions.cc (try_to_debug): Set priority of current thread rather
+ than the main thread. Make busy waiting loop less busy. Restore
+ priority when function returns.
+
2003-02-07 Christopher Faylor <cgf@redhat.com>
* malloc.cc (DEFAULT_MMAP_THRESHOLD): Set high to avoid mmaps.
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 84b2f1751..352cda0d0 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -343,7 +343,8 @@ try_to_debug (bool waitloop)
__small_sprintf (strchr (debugger_command, '\0'), " %u", GetCurrentProcessId ());
- SetThreadPriority (hMainThread, THREAD_PRIORITY_HIGHEST);
+ LONG prio = GetThreadPriority (GetCurrentThread ());
+ SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
PROCESS_INFORMATION pi = {NULL, 0, 0, 0};
STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
@@ -391,15 +392,17 @@ try_to_debug (bool waitloop)
system_printf ("Failed to start debugger: %E");
else
{
- SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE);
+ SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
if (!waitloop)
return 1;
while (!being_debugged ())
- /* spin */;
- Sleep (4000);
+ Sleep (0);
+ Sleep (2000);
small_printf ("*** continuing from debugger call\n");
}
+ SetThreadPriority (GetCurrentThread (), prio);
+
/* FIXME: need to know handles of all running threads to
resume_all_threads_except (current_thread_id);
*/