From 99b54010c6adb327786f2511986cf4ecaafc9d72 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Tue, 28 Feb 2023 21:44:48 +0100 Subject: [PATCH] Handle exceptions from set_priority() --- apf/mimoprocessor.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apf/mimoprocessor.h b/apf/mimoprocessor.h index 9112f51..c2a0f99 100644 --- a/apf/mimoprocessor.h +++ b/apf/mimoprocessor.h @@ -369,10 +369,15 @@ class MimoProcessor : public interface_policy , _parent(parent) , _thread(std::thread(&WorkerThread::_thread_function, this)) { - // Set thread priority from interface_policy, if available - thread_traits::set_priority(parent - , _thread.native_handle()); + try { + // Set thread priority from interface_policy, if available + thread_traits::set_priority(parent + , _thread.native_handle()); + } catch(...) { + this->~WorkerThread(); + throw; + } } WorkerThread(WorkerThread&& other)