| 68 | } |
| 69 | |
| 70 | Task CreateTask(std::function<void()> f, int64 cost = 0) { |
| 71 | uint64 id = 0; |
| 72 | if (tracing::EventCollector::IsEnabled()) { |
| 73 | id = tracing::GetUniqueArg(); |
| 74 | tracing::RecordEvent(tracing::EventCategory::kScheduleClosure, id); |
| 75 | } |
| 76 | |
| 77 | return Task{ |
| 78 | std::unique_ptr<TaskImpl>(new TaskImpl{ |
| 79 | std::move(f), |
| 80 | Context(ContextKind::kThread), |
| 81 | id, |
| 82 | }), cost |
| 83 | }; |
| 84 | } |
| 85 | |
| 86 | void ExecuteTask(const Task& t) { |
| 87 | WithContext wc(t.f->context); |
nothing calls this directly
no test coverage detected