MCPcopy Create free account
hub / github.com/davisking/dlib / thread_helper

Method thread_helper

dlib/threads/threaded_object_extension.cpp:251–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249// ----------------------------------------------------------------------------------------
250
251 void threaded_object::
252 thread_helper(
253 )
254 {
255#ifdef ENABLE_ASSERTS
256 id1 = get_thread_id();
257 id_valid = true;
258#endif
259 while (true)
260 {
261 m_.lock();
262 should_respawn_ = false;
263 m_.unlock();
264
265 thread();
266
267 auto_mutex M(m_);
268
269 if (should_respawn_)
270 continue;
271
272#ifdef ENABLE_ASSERTS
273 id_valid = false;
274#endif
275
276 is_alive_ = false;
277 is_running_ = false;
278 should_stop_ = false;
279 s.broadcast();
280
281 return;
282 }
283 }
284
285// ----------------------------------------------------------------------------------------
286

Callers

nothing calls this directly

Calls 5

get_thread_idFunction · 0.70
threadFunction · 0.50
lockMethod · 0.45
unlockMethod · 0.45
broadcastMethod · 0.45

Tested by

no test coverage detected