Skip to content

Commit

Permalink
Fix noexcept build
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed May 16, 2023
1 parent 0c6a5d0 commit d27d9ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/slang/util/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <type_traits>
#include <vector>

#include "slang/util/Util.h"

namespace slang {

/// A lightweight thread pool for running concurrent jobs.
Expand Down Expand Up @@ -83,7 +85,7 @@ class ThreadPool {
auto taskPromise = std::make_shared<std::promise<TResult>>();

pushTask([func = std::move(func), taskPromise] {
try {
SLANG_TRY {
if constexpr (std::is_void_v<TResult>) {
std::invoke(func);
taskPromise->set_value();
Expand All @@ -92,11 +94,11 @@ class ThreadPool {
taskPromise->set_value(std::invoke(func));
}
}
catch (...) {
try {
SLANG_CATCH(...) {
SLANG_TRY {
taskPromise->set_exception(std::current_exception());
}
catch (...) {
SLANG_CATCH(...) {
}
}
});
Expand Down

0 comments on commit d27d9ac

Please sign in to comment.