MCPcopy Create free account
hub / github.com/ByConity/ByConity / thread

Method thread

src/DataStreams/ParallelInputsProcessor.h:182–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180 }
181
182 void thread(ThreadGroupStatusPtr thread_group, size_t thread_num)
183 {
184 std::exception_ptr exception;
185 CurrentMetrics::Increment metric_increment{CurrentMetrics::QueryThread};
186
187 try
188 {
189 setThreadName("ParalInputsProc");
190 if (thread_group)
191 CurrentThread::attachTo(thread_group);
192
193 while (!finish)
194 {
195 InputData unprepared_input;
196 {
197 std::lock_guard lock(unprepared_inputs_mutex);
198
199 if (unprepared_inputs.empty())
200 break;
201
202 unprepared_input = unprepared_inputs.front();
203 unprepared_inputs.pop();
204 }
205
206 unprepared_input.in->readPrefix();
207
208 {
209 std::lock_guard lock(available_inputs_mutex);
210 available_inputs.push(unprepared_input);
211 }
212 }
213
214 loop(thread_num);
215
216 handler.onFinishThread(thread_num);
217 }
218 catch (...)
219 {
220 exception = std::current_exception();
221 }
222
223 if (exception)
224 {
225 handler.onException(exception, thread_num);
226 }
227
228 /// The last thread on the output indicates that there is no more data.
229 if (0 == --active_threads)
230 {
231 /// And then it processes an additional source, if there is one.
232 if (additional_input_at_end)
233 {
234 try
235 {
236 additional_input_at_end->readPrefix();
237 while (Block block = additional_input_at_end->read())
238 publishPayload(block, thread_num);
239 }

Callers

nothing calls this directly

Calls 11

setThreadNameFunction · 0.85
frontMethod · 0.80
loopFunction · 0.50
emptyMethod · 0.45
popMethod · 0.45
readPrefixMethod · 0.45
pushMethod · 0.45
onFinishThreadMethod · 0.45
onExceptionMethod · 0.45
readMethod · 0.45
onFinishMethod · 0.45

Tested by

no test coverage detected