Skip to content
Snippets Groups Projects
Commit f20aac8b authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Only free tp->threads when allocated, set the mapper function for logging when...

Only free tp->threads when allocated, set the mapper function for logging when only using one thread
parent 56cd847e
Branches
Tags
1 merge request!390Fixes to the threadpool
......@@ -268,6 +268,7 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
if (tp->num_threads == 1) {
map_function(map_data, N, extra_data);
#ifdef SWIFT_DEBUG_THREADPOOL
tp->map_function = map_function;
threadpool_log(tp, 0, N, tic, getticks());
#endif
return;
......@@ -330,10 +331,11 @@ void threadpool_clean(struct threadpool *tp) {
if (pthread_barrier_destroy(&tp->wait_barrier) != 0 ||
pthread_barrier_destroy(&tp->run_barrier) != 0)
error("Failed to destroy threadpool barriers.");
/* Clean up memory. */
free(tp->threads);
}
/* Clean up memory. */
free(tp->threads);
#ifdef SWIFT_DEBUG_THREADPOOL
for (int k = 0; k < tp->num_threads; k++) {
free(tp->logs[k].log);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment