summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygthread.cc
diff options
context:
space:
mode:
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);