- int result;
- pthread_t thread;
-
- result = pthread_create(&thread, NULL,
- (void * (*)(void *))&worker_thread,
- NULL);
- if (result != 0) {
- fprintf(stderr, "failed to create worker thread: %s\n",
- strerror(result));
+ errno = pthread_create(threads + i, NULL, &worker_thread, NULL);
+ if (errno != 0) {
+ perror("failed to create worker thread");