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:
authorCorinna Vinschen <corinna@vinschen.de>2013-03-29 21:00:36 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-03-29 21:00:36 +0400
commit4aa4632ad2c4fa5ee145fa7ffbdf45ba6cc45780 (patch)
tree8d575dc2d5c5c70376ec80435dd226a7ace10b30 /winsup/cygwin/cygthread.cc
parentbb93b7ab95e10ffdf17eeb6e0e055956b92603c3 (diff)
* cygthread.cc (cygthread::terminate_thread): Only try to free
thread stack on systems not freeing it by themselves. * wincap.h (wincaps::terminate_thread_frees_stack): New element. * wincap.cc: Implement above element throughout.
Diffstat (limited to 'winsup/cygwin/cygthread.cc')
-rw-r--r--winsup/cygwin/cygthread.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc
index 9e4ce62ac..325b7e879 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -1,7 +1,7 @@
/* cygthread.cc
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009,
- 2010, 2011, 2012 Red Hat, Inc.
+ 2010, 2011, 2012, 2013 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@@ -313,15 +313,18 @@ cygthread::terminate_thread ()
if (ev && !(terminated = !IsEventSignalled (ev)))
ResetEvent (ev);
- MEMORY_BASIC_INFORMATION m;
- memset (&m, 0, sizeof (m));
- VirtualQuery (stack_ptr, &m, sizeof m);
-
- if (!m.RegionSize)
- system_printf ("m.RegionSize 0? stack_ptr %p", stack_ptr);
- else if (!VirtualFree (m.AllocationBase, 0, MEM_RELEASE))
- debug_printf ("VirtualFree of allocation base %p<%p> failed, %E",
- stack_ptr, m.AllocationBase);
+ if (!wincap.terminate_thread_frees_stack ())
+ {
+ MEMORY_BASIC_INFORMATION m;
+ memset (&m, 0, sizeof (m));
+ VirtualQuery (stack_ptr, &m, sizeof m);
+
+ if (!m.RegionSize)
+ system_printf ("m.RegionSize 0? stack_ptr %p", stack_ptr);
+ else if (!VirtualFree (m.AllocationBase, 0, MEM_RELEASE))
+ debug_printf ("VirtualFree of allocation base %p<%p> failed, %E",
+ stack_ptr, m.AllocationBase);
+ }
if (is_freerange)
free (this);