MCPcopy Create free account
hub / github.com/bloomberg/quantum / processTask

Method processTask

quantum/impl/quantum_task_queue_impl.h:177–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177inline
178TaskQueue::ProcessTaskResult TaskQueue::processTask()
179{
180 WorkItem workItem{nullptr, _runQueue.end(), false, 0};
181 try
182 {
183 //Process a task
184 workItem = grabWorkItem();
185
186 TaskPtr task = workItem._task;
187 if (!task)
188 {
189 return ProcessTaskResult(workItem._isBlocked, workItem._blockedQueueRound);
190 }
191
192 int rc;
193 {
194 // set the current task for local-storage queries
195 IQueue::TaskSetterGuard taskSetter(*this, task);
196 //========================= START/RESUME COROUTINE =========================
197 rc = task->run();
198 //=========================== END/YIELD COROUTINE ==========================
199 }
200
201 switch (rc)
202 {
203 case (int)ITask::RetCode::NotCallable:
204 handleNotCallable(workItem);
205 break;
206 case (int)ITask::RetCode::AlreadyResumed:
207 handleAlreadyResumed(workItem);
208 break;
209 case (int)ITask::RetCode::Blocked:
210 handleBlocked(workItem);
211 break;
212 case (int)ITask::RetCode::Sleeping:
213 handleSleeping(workItem);
214 break;
215 case (int)ITask::RetCode::Running:
216 handleRunning(workItem);
217 break;
218 case (int)ITask::RetCode::Success:
219 handleSuccess(workItem);
220 break;
221 default:
222 handleError(workItem);
223 break;
224 }
225 }
226 catch (const std::exception& ex)
227 {
228 handleException(workItem, &ex);
229 }
230 catch (...)
231 {
232 handleException(workItem);
233 }
234 return ProcessTaskResult(workItem._isBlocked, workItem._blockedQueueRound);

Callers 1

runMethod · 0.80

Calls 3

ProcessTaskResultClass · 0.85
endMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected