| 1453 | template <class RET> |
| 1454 | template <class OTHER_RET, class FUNC, class ... ARGS> |
| 1455 | ContextPtr<OTHER_RET> |
| 1456 | Context<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 | |
| 1481 | template <class RET> |
| 1482 | void* Context<RET>::operator new(size_t) |
nothing calls this directly
no test coverage detected