MCPcopy Create free account
hub / github.com/apache/impala / DrainAndShutdown

Method DrainAndShutdown

be/src/util/thread-pool.h:146–157  ·  view source on GitHub ↗

Blocks until the work queue is empty, and then calls Shutdown to stop the worker threads and Join to wait until they are finished. Any work Offer()'ed during DrainAndShutdown may or may not be processed.

Source from the content-addressed store, hash-verified

144 /// threads and Join to wait until they are finished.
145 /// Any work Offer()'ed during DrainAndShutdown may or may not be processed.
146 void DrainAndShutdown() {
147 {
148 std::unique_lock<std::mutex> l(lock_);
149 // If the ThreadPool is not initialized, then the queue must be empty.
150 DCHECK(initialized_ || work_queue_.Size() == 0);
151 while (work_queue_.Size() != 0) {
152 empty_cv_.Wait(l);
153 }
154 }
155 Shutdown();
156 Join();
157 }
158
159 private:
160 /// Driver method for each thread in the pool. Continues to read work from the queue

Callers 2

TESTFunction · 0.80
TESTFunction · 0.80

Calls 2

SizeMethod · 0.45
WaitMethod · 0.45

Tested by 2

TESTFunction · 0.64
TESTFunction · 0.64