summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-17 14:42:08 -0800
committerRuss Cox <rsc@golang.org>2009-11-17 14:42:08 -0800
commit249e74bd6880845533377c147bab200ed12b8a7f (patch)
tree8cfa042bd039328b895de89f5196ba959e10bde3 /src/pkg/runtime/proc.c
parente79aee93bcf21e865353adec790711aeac5479c9 (diff)
downloadgolang-249e74bd6880845533377c147bab200ed12b8a7f.tar.gz
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 issue 250. R=agl1 CC=golang-dev http://codereview.appspot.com/157044
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 668a478a8..35e2ad77e 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));