[Python-checkins] python/dist/src/Python thread_pthread.h,2.44,2.45

loewis@users.sourceforge.net loewis@users.sourceforge.net
Fri, 18 Apr 2003 04:11:12 -0700


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

Modified Files:
	thread_pthread.h 
Log Message:
Patch #711835: Remove unnecessary lock operations. Will backport to 2.2.


Index: thread_pthread.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v
retrieving revision 2.44
retrieving revision 2.45
diff -C2 -d -r2.44 -r2.45
*** thread_pthread.h	21 Jan 2003 10:14:41 -0000	2.44
--- thread_pthread.h	18 Apr 2003 11:11:09 -0000	2.45
***************
*** 498,504 ****
  	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 ) {
--- 498,501 ----
***************
*** 507,512 ****
  		/* 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,
--- 504,507 ----
***************
*** 514,522 ****
  			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));
--- 509,518 ----
  			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));