summaryrefslogtreecommitdiff
path: root/src/thread_utils.h
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2022-05-17 11:47:01 +0200
committerMikaël Capelle <capelle.mikael@gmail.com>2023-07-09 17:20:40 +0200
commitd13f6bb870cdda71257f665367be8ef9fca86255 (patch)
tree52e214718478f1e52856572f5aa1a2ac58537f9f /src/thread_utils.h
parent86bb01ba9eac879d3685c439ac9da0028bc4bc80 (diff)
Apply clang-format.
Diffstat (limited to 'src/thread_utils.h')
-rw-r--r--src/thread_utils.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/thread_utils.h b/src/thread_utils.h
index e816a4e2..1eec83a6 100644
--- a/src/thread_utils.h
+++ b/src/thread_utils.h
@@ -1,16 +1,16 @@
#ifndef MO2_THREAD_UTILS_H
#define MO2_THREAD_UTILS_H
-#include <log.h>
#include <functional>
+#include <log.h>
#include <mutex>
#include <thread>
// in main.cpp
void setExceptionHandlers();
-
-namespace MOShared {
+namespace MOShared
+{
// starts an std::thread with an unhandled exception handler for core dumps
// and a top-level catch
@@ -18,7 +18,7 @@ namespace MOShared {
template <class F>
std::thread startSafeThread(F&& f)
{
- return std::thread([f=std::forward<F>(f)] {
+ return std::thread([f = std::forward<F>(f)] {
setExceptionHandlers();
f();
});
@@ -47,7 +47,7 @@ void parallelMap(It begin, It end, Callable callable, std::size_t nThreads)
// Create the thread:
// - The mutex is only used to fetch/increment the iterator.
// - The callable is copied in each thread to avoid conflicts.
- for (auto &thread: threads) {
+ for (auto& thread : threads) {
thread = startSafeThread([&m, &begin, end, callable]() {
while (true) {
decltype(begin) it;
@@ -71,6 +71,6 @@ void parallelMap(It begin, It end, Callable callable, std::size_t nThreads)
}
}
-}
+} // namespace MOShared
#endif