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>2012-02-11 21:37:02 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-02-11 21:37:02 +0400
commitce48510394663e2fbac99395030cdecdf0b61671 (patch)
treef294f8f5e8e05d98fb4f999d669927490c422bcc /winsup/cygwin/thread.h
parent793371f584d847db11cfbd9a900cb4bae0f234cf (diff)
* miscfuncs.cc (DEFAULT_STACKSIZE): Remove.
(CygwinCreateThread): Simplify code by assuming that now stack-related input values are undefined. Set stack protection to PAGE_READWRITE, as is default on Windows. Add lengthy comment to explain POSIX guardpage. * thread.cc (pthread_attr::pthread_attr): Initialize stacksize as PTHREAD_DEFAULT_STACKSIZE. Initialize guardsize as PTHREAD_DEFAULT_GUARDSIZE. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Define. Add comment to explain. (PTHREAD_DEFAULT_GUARDSIZE): Define.
Diffstat (limited to 'winsup/cygwin/thread.h')
-rw-r--r--winsup/cygwin/thread.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index fd9724cbb..9adc9e1c7 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -16,6 +16,12 @@ details. */
#define WRITE_LOCK 1
#define READ_LOCK 2
+/* Default is a 1 Megs stack with a 4K guardpage. Since the pthread stacksize
+ does not include the guardpage size, but we don't want to waste another 64K,
+ subtract the default guardpage size from the stacksize. */
+#define PTHREAD_DEFAULT_STACKSIZE (1024 * 1024 - wincap.page_size ())
+#define PTHREAD_DEFAULT_GUARDSIZE (wincap.page_size ())
+
#include <pthread.h>
#include <limits.h>
#include "security.h"