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

Method thread_helper

dlib/threads/multithreaded_object_extension.cpp:206–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204// ----------------------------------------------------------------------------------------
205
206 void multithreaded_object::
207 thread_helper(
208 )
209 {
210 mfp mf;
211 thread_id_type id = get_thread_id();
212
213 // this guy's destructor does all the necessary cleanup in this function
214 raii_thread_helper raii(*this, id);
215
216 // if there is a dead_thread sitting around then pull it
217 // out and put it into mf
218 {
219 auto_mutex M(m_);
220 if (dead_threads.size() > 0)
221 {
222 dead_threads.dequeue(mf);
223 mfp temp(mf);
224 thread_ids.add(id,temp);
225 }
226 }
227
228 if (mf.is_set())
229 {
230 // call the registered thread function
231 mf();
232 }
233 }
234
235// ----------------------------------------------------------------------------------------
236

Callers

nothing calls this directly

Calls 4

get_thread_idFunction · 0.70
sizeMethod · 0.45
addMethod · 0.45
is_setMethod · 0.45

Tested by

no test coverage detected