* 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.
This commit is contained in:
Corinna Vinschen
2012-02-11 17:37:02 +00:00
parent 793371f584
commit ce48510394
4 changed files with 35 additions and 23 deletions

View File

@@ -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"