mcexec: fix number of threads not to exceed thread_data array
This commit is contained in:
@@ -1550,7 +1550,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_threads = ncpu + 1;
|
n_threads = ncpu;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: keep thread_data ncpu sized despite that there are only
|
* XXX: keep thread_data ncpu sized despite that there are only
|
||||||
@@ -1561,6 +1561,10 @@ int main(int argc, char **argv)
|
|||||||
* TODO: implement dynaic thread pool resizing.
|
* TODO: implement dynaic thread pool resizing.
|
||||||
*/
|
*/
|
||||||
thread_data = (struct thread_data_s *)malloc(sizeof(struct thread_data_s) * (ncpu + 1));
|
thread_data = (struct thread_data_s *)malloc(sizeof(struct thread_data_s) * (ncpu + 1));
|
||||||
|
if (!thread_data) {
|
||||||
|
fprintf(stderr, "error: allocating thread pool data\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
memset(thread_data, '\0', sizeof(struct thread_data_s) * (ncpu + 1));
|
memset(thread_data, '\0', sizeof(struct thread_data_s) * (ncpu + 1));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
Reference in New Issue
Block a user