[Python-checkins] python/dist/src/Python thread_pthread.h,2.36.8.3,2.36.8.4 thread_solaris.h,2.16.10.1,2.16.10.2

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 19 Apr 2003 00:46:30 -0700


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

Modified Files:
      Tag: release22-maint
	thread_pthread.h thread_solaris.h 
Log Message:
Patch #716969: Detect thread creation failure.


Index: thread_pthread.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v
retrieving revision 2.36.8.3
retrieving revision 2.36.8.4
diff -C2 -d -r2.36.8.3 -r2.36.8.4
*** thread_pthread.h	18 Apr 2003 11:21:22 -0000	2.36.8.3
--- thread_pthread.h	19 Apr 2003 07:46:28 -0000	2.36.8.4
***************
*** 154,158 ****
  {
  	pthread_t th;
! 	int success;
   	sigset_t oldmask, newmask;
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
--- 154,158 ----
  {
  	pthread_t th;
! 	int status;
   	sigset_t oldmask, newmask;
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
***************
*** 180,184 ****
  	SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask);
  
! 	success = pthread_create(&th, 
  #if defined(PY_PTHREAD_D4)
  				 pthread_attr_default,
--- 180,184 ----
  	SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask);
  
! 	status = pthread_create(&th, 
  #if defined(PY_PTHREAD_D4)
  				 pthread_attr_default,
***************
*** 210,220 ****
  	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;
--- 210,222 ----
  	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.16.10.1
retrieving revision 2.16.10.2
diff -C2 -d -r2.16.10.1 -r2.16.10.2
*** thread_solaris.h	12 Jan 2002 11:13:24 -0000	2.16.10.1
--- thread_solaris.h	19 Apr 2003 07:46:28 -0000	2.16.10.2
***************
*** 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;