]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: handle out-of-threads on Linux gracefully
authorAlbert Strasheim <fullung@gmail.com>
Fri, 6 May 2011 19:29:49 +0000 (15:29 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 6 May 2011 19:29:49 +0000 (15:29 -0400)
R=rsc
CC=golang-dev
https://golang.org/cl/4396050

src/pkg/runtime/linux/thread.c

index 7166b0ef27f6af45c2b038dd2f4a9c5e65ebf207..6c506236fbfa17fbbea0642891e0620a56a353d5 100644 (file)
@@ -252,10 +252,10 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
                        stk, m, g, fn, runtime·clone, m->id, m->tls[0], &m);
        }
 
-       ret = runtime·clone(flags, stk, m, g, fn);
-
-       if(ret < 0)
-               *(int32*)123 = 123;
+       if((ret = runtime·clone(flags, stk, m, g, fn)) < 0) {
+               runtime·printf("runtime: failed to create new OS thread (have %d already; errno=%d)\n", runtime·mcount(), -ret);
+               runtime·throw("runtime.newosproc");
+       }
 }
 
 void