[Python-checkins] python/dist/src/Python thread_pthread.h,2.45,2.46 thread_solaris.h,2.18,2.19

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 19 Apr 2003 00:44:54 -0700


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

Modified Files:
	thread_pthread.h thread_solaris.h 
Log Message:
Patch #716969: Detect thread creation failure. Will backport to 2.2.


Index: thread_pthread.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v
retrieving revision 2.45
retrieving revision 2.46
diff -C2 -d -r2.45 -r2.46
*** thread_pthread.h	18 Apr 2003 11:11:09 -0000	2.45
--- thread_pthread.h	19 Apr 2003 07:44:52 -0000	2.46
***************
*** 189,193 ****
  {
  	pthread_t th;
! 	int success;
   	sigset_t oldmask, newmask;
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
--- 189,193 ----
  {
  	pthread_t th;
! 	int status;
   	sigset_t oldmask, newmask;
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
***************
*** 215,219 ****
  	SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask);
  
! 	success = pthread_create(&th, 
  #if defined(PY_PTHREAD_D4)
  				 pthread_attr_default,
--- 215,219 ----
  	SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask);
  
! 	status = pthread_create(&th, 
  #if defined(PY_PTHREAD_D4)
  				 pthread_attr_default,
***************
*** 245,255 ****
  	pthread_attr_destroy(&attrs);
  #endif
! 	if (success == 0) {
  #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)
! 		pthread_detach(&th);
  #elif defined(PY_PTHREAD_STD)
! 		pthread_detach(th);
  #endif
! 	}
  #if SIZEOF_PTHREAD_T <= SIZEOF_LONG
  	return (long) th;
--- 245,257 ----
  	pthread_attr_destroy(&attrs);
  #endif
! 	if (status != 0)
!             return -1;
! 
  #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)
!         pthread_detach(&th);
  #elif defined(PY_PTHREAD_STD)
!         pthread_detach(th);
  #endif
! 
  #if SIZEOF_PTHREAD_T <= SIZEOF_LONG
  	return (long) th;

Index: thread_solaris.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_solaris.h,v
retrieving revision 2.18
retrieving revision 2.19
diff -C2 -d -r2.18 -r2.19
*** thread_solaris.h	19 Jan 2002 22:02:55 -0000	2.18
--- thread_solaris.h	19 Apr 2003 07:44:52 -0000	2.19
***************
*** 41,46 ****
  	thread_t tid;
  	struct func_arg *funcarg;
- 	int success = 0;	/* init not needed when SOLARIS_THREADS and */
- 				/* C_THREADS implemented properly */
  
  	dprintf(("PyThread_start_new_thread called\n"));
--- 41,44 ----
***************
*** 54,58 ****
  		perror("thr_create");
  		free((void *) funcarg);
! 		success = -1;
  	}
  	return tid;
--- 52,56 ----
  		perror("thr_create");
  		free((void *) funcarg);
! 		return -1;
  	}
  	return tid;