MCPcopy Create free account
hub / github.com/apache/thrift / start

Method start

lib/cpp/src/thrift/concurrency/Thread.h:121–139  ·  view source on GitHub ↗

* Starts the thread. Does platform specific thread creation and * configuration then invokes the run method of the Runnable object bound * to this thread. */

Source from the content-addressed store, hash-verified

119 * to this thread.
120 */
121 virtual void start() {
122 if (getState() != uninitialized) {
123 return;
124 }
125
126 std::shared_ptr<Thread> selfRef = shared_from_this();
127 setState(starting);
128
129 Synchronized sync(monitor_);
130 thread_ = std::unique_ptr<std::thread>(new std::thread(getThreadFunc(), selfRef));
131
132 if (detached_)
133 thread_->detach();
134
135 // Wait for the thread to start and get far enough to grab everything
136 // that it needs from the calling context, thus absolving the caller
137 // from being required to hold on to runnable indefinitely.
138 monitor_.wait();
139 }
140
141 /**
142 * Join this thread. If this thread is joinable, the calling thread blocks

Callers 8

testParallelCallsMethod · 0.95
test_normalconnectionMethod · 0.95
serveMethod · 0.95
serveMethod · 0.95
registerEventsMethod · 0.45
onClientConnectedMethod · 0.45

Calls 1

waitMethod · 0.45

Tested by 3

testParallelCallsMethod · 0.76
test_normalconnectionMethod · 0.76