| 128 | // ---------------------------------------------------------------------------------------- |
| 129 | |
| 130 | void threaded_object:: |
| 131 | restart ( |
| 132 | ) |
| 133 | { |
| 134 | auto_mutex M(m_); |
| 135 | |
| 136 | DLIB_ASSERT(id1 != get_thread_id() || id_valid == false, |
| 137 | "\tvoid threaded_object::restart()" |
| 138 | << "\n\tYou can NOT call this function from the thread that executes threaded_object::thread" |
| 139 | << "\n\tthis: " << this |
| 140 | ); |
| 141 | |
| 142 | if (is_alive_ == false) |
| 143 | { |
| 144 | if (create_new_thread<threaded_object,&threaded_object::thread_helper>(*this) == false) |
| 145 | { |
| 146 | is_running_ = false; |
| 147 | throw thread_error(); |
| 148 | } |
| 149 | should_respawn_ = false; |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | should_respawn_ = true; |
| 154 | } |
| 155 | is_alive_ = true; |
| 156 | is_running_ = true; |
| 157 | should_stop_ = false; |
| 158 | s.broadcast(); |
| 159 | } |
| 160 | |
| 161 | // ---------------------------------------------------------------------------------------- |
| 162 |
nothing calls this directly
no test coverage detected