runtime/cgo: check for errors from pthread_create

R=rsc, iant, dvyukov
CC=golang-dev
https://golang.org/cl/4643057
This commit is contained in:
Albert Strasheim 2011-06-28 12:04:50 -04:00 committed by Russ Cox
parent 660b22988b
commit a026d0fc76
7 changed files with 47 additions and 8 deletions

View file

@ -20,11 +20,16 @@ libcgo_sys_thread_start(ThreadStart *ts)
pthread_attr_t attr;
pthread_t p;
size_t size;
int err;
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
pthread_create(&p, &attr, threadentry, ts);
err = pthread_create(&p, &attr, threadentry, ts);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
abort();
}
}
static void*