According to http://pubs.opengroup.org/onlinepubs/
009695399/functions/pthread_key_create.html,
pthread_key_create return an error number which is greater than or equal
to 0. I don't know the scenario that pthread_setspecific would fail, but
also don't know the future. Add some error handlings just in case.
Change-Id: I0774b79ef658d67e300f4a9aab1f2e3879acc7ee
Reviewed-on: https://go-review.googlesource.com/54811
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
*/
ntofree = 0;
for(;;) {
- if(pthread_key_create(&k, nil) < 0) {
+ if(pthread_key_create(&k, nil) != 0) {
fprintf(stderr, "runtime/cgo: pthread_key_create failed\n");
abort();
}
ts = *(ThreadStart*)v;
free(v);
- pthread_setspecific(k1, (void*)ts.g);
+ if (pthread_setspecific(k1, (void*)ts.g) != 0) {
+ fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
+ abort();
+ }
crosscall_386(ts.fn);
return nil;
*/
ntofree = 0;
for(;;) {
- if(pthread_key_create(&k, nil) < 0) {
+ if(pthread_key_create(&k, nil) != 0) {
fprintf(stderr, "runtime/cgo: pthread_key_create failed\n");
abort();
}
ts = *(ThreadStart*)v;
free(v);
- pthread_setspecific(k1, (void*)ts.g);
+ if (pthread_setspecific(k1, (void*)ts.g) != 0) {
+ fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
+ abort();
+ }
crosscall_amd64(ts.fn);
return nil;
*/
ntofree = 0;
for(;;) {
- if(pthread_key_create(&k, nil) < 0) {
+ if(pthread_key_create(&k, nil) != 0) {
fprintf(stderr, "runtime/cgo: pthread_key_create failed\n");
abort();
}
ts = *(ThreadStart*)v;
free(v);
- pthread_setspecific(k1, (void*)ts.g);
+ if (pthread_setspecific(k1, (void*)ts.g) != 0) {
+ fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
+ abort();
+ }
crosscall_386(ts.fn);
return nil;
*/
ntofree = 0;
for(;;) {
- if(pthread_key_create(&k, nil) < 0) {
+ if(pthread_key_create(&k, nil) != 0) {
fprintf(stderr, "runtime/cgo: pthread_key_create failed\n");
abort();
}
ts = *(ThreadStart*)v;
free(v);
- pthread_setspecific(k1, (void*)ts.g);
+ if (pthread_setspecific(k1, (void*)ts.g) != 0) {
+ fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
+ abort();
+ }
crosscall_amd64(ts.fn);
return nil;