Commit ff7d7b27 authored by Alex Brainman's avatar Alex Brainman

runtime: detect failed thread creation on Windows

Fixes #1495.

R=rsc
CC=golang-dev
https://golang.org/cl/4182047
parent 29ae8e9a
......@@ -184,11 +184,17 @@ runtime·notesleep(Note *n)
void
runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
{
void *thandle;
USED(stk);
USED(g); // assuming g = m->g0
USED(fn); // assuming fn = mstart
runtime·stdcall(runtime·CreateThread, 6, 0, 0, runtime·tstart_stdcall, m, 0, 0);
thandle = runtime·stdcall(runtime·CreateThread, 6, 0, 0, runtime·tstart_stdcall, m, 0, 0);
if(thandle == 0) {
runtime·printf("runtime: failed to create new OS thread (have %d already; errno=%d)\n", runtime·mcount(), runtime·getlasterror());
runtime·throw("runtime.newosproc");
}
}
// Called to initialize a new m (including the bootstrap m).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment