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

Method Init

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

Create the threads needed for this ThreadPool. Returns an error on any error spawning the threads.

Source from the content-addressed store, hash-verified

66 /// Create the threads needed for this ThreadPool. Returns an error on any
67 /// error spawning the threads.
68 Status Init() {
69 for (int i = 0; i < num_threads_; ++i) {
70 std::stringstream threadname;
71 threadname << thread_prefix_ << "(" << i + 1 << ":" << num_threads_ << ")";
72 std::unique_ptr<Thread> t;
73 Status status = Thread::Create(group_, threadname.str(),
74 boost::bind<void>(boost::mem_fn(&ThreadPool<T>::WorkerThread), this, i), &t,
75 fault_injection_eligible_);
76 if (!status.ok()) {
77 // The thread pool initialization failed. Shutdown any threads that were
78 // spawned. Note: Shutdown() and Join() are safe to call multiple times.
79 Shutdown();
80 Join();
81 return status;
82 }
83 threads_.AddThread(std::move(t));
84 }
85 initialized_ = true;
86 return Status::OK();
87 }
88
89 /// Blocking operation that puts a work item on the queue. If the queue is full, blocks
90 /// until there is capacity available. The ThreadPool must be initialized before

Callers

nothing calls this directly

Calls 6

CreateClass · 0.85
moveFunction · 0.85
OKFunction · 0.85
strMethod · 0.45
okMethod · 0.45
AddThreadMethod · 0.45

Tested by

no test coverage detected