| 9 | namespace vsomeip_v3 { |
| 10 | |
| 11 | thread_manager::~thread_manager() { |
| 12 | std::scoped_lock its_lock{thread_mutex_}; |
| 13 | for (auto& thread : thread_vector_) { |
| 14 | try { |
| 15 | if (thread->get_id() == std::this_thread::get_id()) { |
| 16 | fprintf(stderr, "Unable to join dispatcher thread: dispatcher thread called exit after stopping application\n"); |
| 17 | fprintf(stderr, "Detaching dispatcher thread (WILL CAUSE LEAKS!)\n"); |
| 18 | thread->detach(); |
| 19 | continue; |
| 20 | } |
| 21 | |
| 22 | thread->join(); |
| 23 | } catch (const std::system_error& e) { |
| 24 | fprintf(stderr, "error: While trying to join a detached thread: %s\n", e.what()); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | thread_manager* thread_manager::get() { |
| 30 | // Use flag set by a custom deleter as a safety check in case something tries to save a thread during |