diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-17 06:42:06 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-17 06:42:06 +0000 |
commit | a4ad1c7a089e4bbb21dc6e9f97d4beef52577d6a (patch) | |
tree | 668c072e9d31643ee62b14c735517b3a4114f61d /libgo/runtime/mgc0.c | |
parent | 785e11cc211af0d7c57b56bb063b44ced381d078 (diff) | |
download | gcc-a4ad1c7a089e4bbb21dc6e9f97d4beef52577d6a.tar.gz |
Rework locking code to split stack much less.
From-SVN: r167973
Diffstat (limited to 'libgo/runtime/mgc0.c')
-rw-r--r-- | libgo/runtime/mgc0.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c index 06e557fcc71..1a1a5ace834 100644 --- a/libgo/runtime/mgc0.c +++ b/libgo/runtime/mgc0.c @@ -27,7 +27,7 @@ struct BlockList }; static bool finstarted; -static Lock finqlock = LOCK_INITIALIZER; +static pthread_mutex_t finqlock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t finqcond = PTHREAD_COND_INITIALIZER; static Finalizer *finq; static int32 fingwait; @@ -284,7 +284,7 @@ sweep(void) sweepspan(s); } -static Lock gcsema = LOCK_INITIALIZER; +static pthread_mutex_t gcsema = PTHREAD_MUTEX_INITIALIZER; // Initialized from $GOGC. GOGC=off means no gc. // @@ -327,8 +327,8 @@ runtime_gc(int32 force __attribute__ ((unused))) if(gcpercent < 0) return; - runtime_lock(&finqlock); - runtime_lock(&gcsema); + pthread_mutex_lock(&finqlock); + pthread_mutex_lock(&gcsema); m->locks++; // disable gc during the mallocs in newproc t0 = runtime_nanotime(); runtime_stoptheworld(); @@ -345,7 +345,7 @@ runtime_gc(int32 force __attribute__ ((unused))) mstats.pause_ns += t1 - t0; if(mstats.debuggc) runtime_printf("pause %llu\n", (unsigned long long)t1-t0); - runtime_unlock(&gcsema); + pthread_mutex_unlock(&gcsema); runtime_starttheworld(); // finqlock is still held. @@ -362,7 +362,7 @@ runtime_gc(int32 force __attribute__ ((unused))) } } m->locks--; - runtime_unlock(&finqlock); + pthread_mutex_unlock(&finqlock); } static void @@ -373,16 +373,16 @@ runfinq(void* dummy) USED(dummy); for(;;) { - runtime_lock(&finqlock); + pthread_mutex_lock(&finqlock); f = finq; finq = nil; if(f == nil) { fingwait = 1; - pthread_cond_wait(&finqcond, &finqlock.mutex); - runtime_unlock(&finqlock); + pthread_cond_wait(&finqcond, &finqlock); + pthread_mutex_unlock(&finqlock); continue; } - runtime_unlock(&finqlock); + pthread_mutex_unlock(&finqlock); for(; f; f=next) { void *params[1]; |