This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gccgo] Rename finlock


I introduced finlock into mgc0.c without realizing that there was
already a finlock in mfinal.c.  This was not a bug, since the one in
mgc0.c is static, but having two variables with the same name is
confusing.  This patch fixes it.  Committed to gccgo branch.

Ian

Index: libgo/runtime/mgc0.c
===================================================================
--- libgo/runtime/mgc0.c	(revision 162490)
+++ libgo/runtime/mgc0.c	(working copy)
@@ -20,8 +20,8 @@ enum {
 };
 
 static bool finstarted;
-static Lock finlock = LOCK_INITIALIZER;
-static pthread_cond_t fincond = PTHREAD_COND_INITIALIZER;
+static Lock finqlock = LOCK_INITIALIZER;
+static pthread_cond_t finqcond = PTHREAD_COND_INITIALIZER;
 static Finalizer *finq;
 static int32 fingwait;
 
@@ -311,7 +311,7 @@ gc(int32 force __attribute__ ((unused)))
 	if(gcpercent < 0)
 		return;
 
-	lock(&finlock);
+	lock(&finqlock);
 	lock(&gcsema);
 	m->locks++;	// disable gc during the mallocs in newproc
 	t0 = nanotime();
@@ -331,7 +331,7 @@ gc(int32 force __attribute__ ((unused)))
 	unlock(&gcsema);
 	starttheworld();
 
-	// finlock is still held.
+	// finqlock is still held.
 	fp = finq;
 	if(fp != nil) {
 		// kick off or wake up goroutine to run queued finalizers
@@ -341,11 +341,11 @@ gc(int32 force __attribute__ ((unused)))
 		}
 		else if(fingwait) {
 			fingwait = 0;
-			pthread_cond_signal(&fincond);
+			pthread_cond_signal(&finqcond);
 		}
 	}
 	m->locks--;
-	unlock(&finlock);
+	unlock(&finqlock);
 }
 
 static void
@@ -356,16 +356,16 @@ runfinq(void* dummy)
 	USED(dummy);
 
 	for(;;) {
-		lock(&finlock);
+		lock(&finqlock);
 		f = finq;
 		finq = nil;
 		if(f == nil) {
 			fingwait = 1;
-			pthread_cond_wait(&fincond, &finlock.mutex);
-			unlock(&finlock);
+			pthread_cond_wait(&finqcond, &finqlock.mutex);
+			unlock(&finqlock);
 			continue;
 		}
-		unlock(&finlock);
+		unlock(&finqlock);
 		for(; f; f=next) {
 			void *params[1];
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]