Implementation
| 2192 | |
| 2193 | // Implementation |
| 2194 | struct Task { |
| 2195 | TaskPriority taskID; |
| 2196 | double time; |
| 2197 | uint64_t stable; |
| 2198 | ProcessInfo* machine; |
| 2199 | Promise<Void> action; |
| 2200 | Task(double time, TaskPriority taskID, uint64_t stable, ProcessInfo* machine, Promise<Void>&& action) |
| 2201 | : taskID(taskID), time(time), stable(stable), machine(machine), action(std::move(action)) {} |
| 2202 | Task(double time, TaskPriority taskID, uint64_t stable, ProcessInfo* machine, Future<Void>& future) |
| 2203 | : taskID(taskID), time(time), stable(stable), machine(machine) { |
| 2204 | future = action.getFuture(); |
| 2205 | } |
| 2206 | Task(Task&& rhs) noexcept |
| 2207 | : taskID(rhs.taskID), time(rhs.time), stable(rhs.stable), machine(rhs.machine), |
| 2208 | action(std::move(rhs.action)) {} |
| 2209 | void operator=(Task const& rhs) { |
| 2210 | taskID = rhs.taskID; |
| 2211 | time = rhs.time; |
| 2212 | stable = rhs.stable; |
| 2213 | machine = rhs.machine; |
| 2214 | action = rhs.action; |
| 2215 | } |
| 2216 | Task(Task const& rhs) |
| 2217 | : taskID(rhs.taskID), time(rhs.time), stable(rhs.stable), machine(rhs.machine), action(rhs.action) {} |
| 2218 | void operator=(Task&& rhs) noexcept { |
| 2219 | time = rhs.time; |
| 2220 | taskID = rhs.taskID; |
| 2221 | stable = rhs.stable; |
| 2222 | machine = rhs.machine; |
| 2223 | action = std::move(rhs.action); |
| 2224 | } |
| 2225 | |
| 2226 | bool operator<(Task const& rhs) const { |
| 2227 | // Ordering is reversed for priority_queue |
| 2228 | if (time != rhs.time) |
| 2229 | return time > rhs.time; |
| 2230 | return stable > rhs.stable; |
| 2231 | } |
| 2232 | }; |
| 2233 | |
| 2234 | void execTask(struct Task& t) { |
| 2235 | if (t.machine->failed) { |
no outgoing calls
no test coverage detected