! * \brief Destructor with cleanup */
| 124 | * \brief Destructor with cleanup |
| 125 | */ |
| 126 | virtual ~Thread() { |
| 127 | const bool self_delete = is_current_thread(); |
| 128 | if (!self_delete) { |
| 129 | request_shutdown(); |
| 130 | internal_join(true); |
| 131 | } |
| 132 | WriteLock guard(thread_mutex_); |
| 133 | if (thread_.load()) { |
| 134 | std::thread *thrd = thread_.load(); |
| 135 | thread_ = nullptr; |
| 136 | if (self_delete) { |
| 137 | thrd->detach(); |
| 138 | } |
| 139 | delete thrd; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /*! |
| 144 | * \brief Name of the thread |
nothing calls this directly
no outgoing calls
no test coverage detected