[Python-checkins] python/dist/src/Python thread_pthread.h,2.36.8.2,2.36.8.3

loewis@users.sourceforge.net loewis@users.sourceforge.net
Fri, 18 Apr 2003 04:21:28 -0700


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

Modified Files:
      Tag: release22-maint
	thread_pthread.h 
Log Message:
Patch #711835: Remove unnecessary lock operations.


Index: thread_pthread.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v
retrieving revision 2.36.8.2
retrieving revision 2.36.8.3
diff -C2 -d -r2.36.8.2 -r2.36.8.3
*** thread_pthread.h	4 Oct 2002 10:16:27 -0000	2.36.8.2
--- thread_pthread.h	18 Apr 2003 11:21:22 -0000	2.36.8.3
***************
*** 360,366 ****
  	CHECK_STATUS("pthread_mutex_lock[1]");
  	success = thelock->locked == 0;
- 	if (success) thelock->locked = 1;
- 	status = pthread_mutex_unlock( &thelock->mut );
- 	CHECK_STATUS("pthread_mutex_unlock[1]");
  
  	if ( !success && waitflag ) {
--- 360,363 ----
***************
*** 369,374 ****
  		/* mut must be locked by me -- part of the condition
  		 * protocol */
- 		status = pthread_mutex_lock( &thelock->mut );
- 		CHECK_STATUS("pthread_mutex_lock[2]");
  		while ( thelock->locked ) {
  			status = pthread_cond_wait(&thelock->lock_released,
--- 366,369 ----
***************
*** 376,384 ****
  			CHECK_STATUS("pthread_cond_wait");
  		}
- 		thelock->locked = 1;
- 		status = pthread_mutex_unlock( &thelock->mut );
- 		CHECK_STATUS("pthread_mutex_unlock[2]");
  		success = 1;
  	}
  	if (error) success = 0;
  	dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
--- 371,380 ----
  			CHECK_STATUS("pthread_cond_wait");
  		}
  		success = 1;
  	}
+ 	if (success) thelock->locked = 1;
+ 	status = pthread_mutex_unlock( &thelock->mut );
+ 	CHECK_STATUS("pthread_mutex_unlock[1]");
+ 
  	if (error) success = 0;
  	dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));