diff options
author | Russ Cox <rsc@golang.org> | 2009-11-17 14:42:08 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-11-17 14:42:08 -0800 |
commit | 4dfd7fdde5957e4f3ba1a0285333f7c807c28f03 (patch) | |
tree | 87cbbfa7cd41537a176fbde87d84844ea49590a6 | |
parent | 33d10e4d32db8fede59977355767bfa91ae06bad (diff) | |
download | go-4dfd7fdde5957e4f3ba1a0285333f7c807c28f03.tar.gz go-4dfd7fdde5957e4f3ba1a0285333f7c807c28f03.zip |
runtime: do not create new threads during malloc.
the signal handling stack is a different size than
the normal stack, so it cannot be allocated using
the backup stack allocator.
Fixes #250.
R=agl1
CC=golang-dev
https://golang.org/cl/157044
-rw-r--r-- | src/pkg/runtime/proc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 668a478a80..35e2ad77ea 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -146,7 +146,7 @@ tracebackothers(G *me) for(g = allg; g != nil; g = g->alllink) { if(g == me || g->status == Gdead) continue; - printf("\ngoroutine %d:\n", g->goid); + printf("\ngoroutine %d [%d]:\n", g->goid, g->status); traceback(g->sched.pc, g->sched.sp, g); } } @@ -411,10 +411,13 @@ struct CgoThreadStart static void matchmg(void) { - M *m; G *g; + if(m->mallocing) + return; while(sched.mcpu < sched.mcpumax && (g = gget()) != nil){ + M *m; + // Find the m that will run g. if((m = mget(g)) == nil){ m = malloc(sizeof(M)); |