Add ceiling on num_threads

master
Nick Krichevsky 2019-09-22 14:42:51 -04:00
parent b2617eaaae
commit 52bb13efd6
1 changed files with 2 additions and 0 deletions

2
main.c
View File

@ -85,7 +85,9 @@ int main(int argc, char *argv[]) {
if (errno == ERANGE || (num_threads == 0 && errno == EINVAL)) {
printf("Invalid number of threads.\n");
}
num_threads = num_threads > MAXTHREAD ? MAXTHREAD : num_threads;
// TODO: Remove this. It's for debugging.
int num_inputs = get_input(num_threads, &inputs);
for (int i = 0; i < num_inputs; i++) {
printf("#%d recipient=%d value=%d\n", i, inputs[i].recipient, inputs[i].value);