]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: do not create new threads during malloc.
authorRuss Cox <rsc@golang.org>
Tue, 17 Nov 2009 22:42:08 +0000 (14:42 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 17 Nov 2009 22:42:08 +0000 (14:42 -0800)
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

src/pkg/runtime/proc.c

index 668a478a802185ee94eec4f4dfbd2c993132824e..35e2ad77eac45c7d5d159dc092eac4c0c23b46cc 100644 (file)
@@ -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));