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

Method start

dlib/threads/threaded_object_extension.cpp:102–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100// ----------------------------------------------------------------------------------------
101
102 void threaded_object::
103 start (
104 )
105 {
106 auto_mutex M(m_);
107
108 DLIB_ASSERT(id1 != get_thread_id() || id_valid == false,
109 "\tvoid threaded_object::start()"
110 << "\n\tYou can NOT call this function from the thread that executes threaded_object::thread"
111 << "\n\tthis: " << this
112 );
113
114 if (is_alive_ == false)
115 {
116 if (create_new_thread<threaded_object,&threaded_object::thread_helper>(*this) == false)
117 {
118 is_running_ = false;
119 throw thread_error();
120 }
121 }
122 is_alive_ = true;
123 is_running_ = true;
124 should_stop_ = false;
125 s.broadcast();
126 }
127
128// ----------------------------------------------------------------------------------------
129

Callers

nothing calls this directly

Calls 3

thread_errorClass · 0.85
get_thread_idFunction · 0.70
broadcastMethod · 0.45

Tested by

no test coverage detected