Skip to content

Commit

Permalink
Warn if thread pool cleanup fails
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Feb 7, 2024
1 parent 927b982 commit 876e3cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ammonite/core/threadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "../types.hpp"
#include "../utils/debug.hpp"
#include "../utils/logging.hpp"

#define MAX_EXTRA_THREADS 512

Expand Down Expand Up @@ -252,7 +253,11 @@ namespace ammonite {

//Wait until all threads are done
for (unsigned int i = 0; i < extraThreadCount; i++) {
threadPool[i].thread.join();
try {
threadPool[i].thread.join();
} catch (const std::system_error&) {
ammonite::utils::warning << "Failed to join thread " << i << " while destroying thread pool" << std::endl;
}
}

/* In debug mode, check that the queue is empty, and matches the job counter
Expand Down

0 comments on commit 876e3cb

Please sign in to comment.