Skip to content

Commit

Permalink
Fix warnings found on Windows in util.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldesnogu committed Sep 11, 2024
1 parent cec7c6c commit 3240fd9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8874,7 +8874,6 @@ exit(0);
int get_num_cores(void)
{
long nprocs = -1;
long nprocs_max = -1;

#if defined(OS_TYPE_WINDOWS) || defined(__MINGW32__) // NB: Currently only support || builds unde Linux/GCC, but add Win stuff for possible future use

Expand All @@ -8889,7 +8888,7 @@ exit(0);
fprintf(stderr, "Could not determine number of CPUs online:\n%s\n", strerror (errno));
exit (EXIT_FAILURE);
}
nprocs_max = sysconf(_SC_NPROCESSORS_CONF);
long nprocs_max = sysconf(_SC_NPROCESSORS_CONF);
if (nprocs_max < 1) {
fprintf(stderr, "Could not determine number of CPUs configured:\n%s\n", strerror (errno));
exit (EXIT_FAILURE);
Expand Down Expand Up @@ -8994,7 +8993,7 @@ exit(0);
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
if(verbose) printf("Main: completed join with thread %d having a status of %ld\n",tid,(long)status);
if(verbose) printf("Main: completed join with thread %d having a status of %zd\n",tid,(intptr_t)status);
isum += retval[tid];
}
}
Expand All @@ -9020,7 +9019,7 @@ exit(0);
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
if(verbose) printf("Main: completed join with thread %d having a status of %ld\n",tid,(long)status);
if(verbose) printf("Main: completed join with thread %d having a status of %zd\n",tid,(intptr_t)status);
isum += retval[tid];
}
}
Expand All @@ -9047,6 +9046,8 @@ exit(0);
}
/* terminate the thread */
pthread_exit(NULL);
// This is unreachable but Windows complains the function doesn't return any value.
return NULL;
}

// A little hello-world testcode for the pthread stuff:
Expand All @@ -9058,6 +9059,8 @@ exit(0);
printf("Hello World! It's me, thread #%ld!\n", tid);
#endif
pthread_exit(NULL);
// This is unreachable but Windows complains the function doesn't return any value.
return NULL;
}

void*
Expand Down Expand Up @@ -9099,6 +9102,8 @@ exit(0);
}
*(thread_arg->retval) = k;
pthread_exit(NULL);
// This is unreachable but Windows complains the function doesn't return any value.
return NULL;
}

/********* Thread-affinity utilities: *********/
Expand Down

0 comments on commit 3240fd9

Please sign in to comment.