[Python-checkins] CVS: python/dist/src/Python thread_pthread.h,2.30,2.31

Jack Jansen jackjansen@users.sourceforge.net
Wed, 29 Aug 2001 08:24:56 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv21036/python/Python

Modified Files:
	thread_pthread.h 
Log Message:
GUSI on the Mac creates threads with a default stack size of 20KB, which is
not enough for Python. Increased the stacksize to a (somewhat arbitrary)
64KB.

Index: thread_pthread.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v
retrieving revision 2.30
retrieving revision 2.31
diff -C2 -d -r2.30 -r2.31
*** thread_pthread.h	2000/09/01 23:29:28	2.30
--- thread_pthread.h	2001/08/29 15:24:53	2.31
***************
*** 49,53 ****
--- 49,60 ----
  #endif
  
+ #ifdef USE_GUSI
+ /* The Macintosh GUSI I/O library sets the stackspace to
+ ** 20KB, much too low. We up it to 64K.
+ */
+ #define THREAD_STACK_SIZE 0x10000
+ #endif
  
+ 
  /* set default attribute object for different versions */
  
***************
*** 129,136 ****
--- 136,150 ----
  	pthread_t th;
  	int success;
+ #ifdef THREAD_STACK_SIZE
+ 	pthread_attr_t attrs;
+ #endif
  	dprintf(("PyThread_start_new_thread called\n"));
  	if (!initialized)
  		PyThread_init_thread();
  
+ #ifdef THREAD_STACK_SIZE
+ 	pthread_attr_init(&attrs);
+ 	pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE);
+ #endif
  	success = pthread_create(&th, 
  #if defined(PY_PTHREAD_D4)
***************
*** 147,156 ****
  				 arg
  #elif defined(PY_PTHREAD_STD)
  				 (pthread_attr_t*)NULL,
  				 (void* (*)(void *))func,
  				 (void *)arg
  #endif
  				 );
! 
  	if (success == 0) {
  #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)
--- 161,176 ----
  				 arg
  #elif defined(PY_PTHREAD_STD)
+ #ifdef THREAD_STACK_SIZE
+ 				 &attrs,
+ #else
  				 (pthread_attr_t*)NULL,
+ #endif
  				 (void* (*)(void *))func,
  				 (void *)arg
  #endif
  				 );
! #ifdef THREAD_STACK_SIZE
! 	pthread_attr_destroy(&attrs);
! #endif
  	if (success == 0) {
  #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)