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

Method postImpl

quantum/impl/quantum_context_impl.h:1455–1479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1453template <class RET>
1454template <class OTHER_RET, class FUNC, class ... ARGS>
1455ContextPtr<OTHER_RET>
1456Context<RET>::postImpl(int queueId, bool isHighPriority, ITask::Type type, FUNC&& func, ARGS&&... args)
1457{
1458 using FirstArg = decltype(firstArgOf(func));
1459 if (queueId < (int)IQueue::QueueId::Same)
1460 {
1461 throw std::out_of_range(std::string{"Invalid coroutine queue id: "} + std::to_string(queueId));
1462 }
1463 auto ctx = ContextPtr<OTHER_RET>(new Context<OTHER_RET>(*_dispatcher),
1464 Context<OTHER_RET>::deleter);
1465 auto task = Task::Ptr(new Task(Traits::IsVoidContext<FirstArg>{},
1466 ctx,
1467 (queueId == (int)IQueue::QueueId::Same) ? _task->getQueueId() : queueId,
1468 isHighPriority,
1469 type,
1470 std::forward<FUNC>(func),
1471 std::forward<ARGS>(args)...),
1472 Task::deleter);
1473 ctx->setTask(task);
1474 if (type == ITask::Type::Standalone)
1475 {
1476 _dispatcher->post(task);
1477 }
1478 return ctx;
1479}
1480
1481template <class RET>
1482void* Context<RET>::operator new(size_t)

Callers

nothing calls this directly

Calls 3

setTaskMethod · 0.80
getQueueIdMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected