* Join the next finished job, if available. */
| 66 | * Join the next finished job, if available. |
| 67 | */ |
| 68 | void LinkGraphSchedule::JoinNext() |
| 69 | { |
| 70 | if (this->running.empty()) return; |
| 71 | LinkGraphJob *next = this->running.front(); |
| 72 | if (!next->IsScheduledToBeJoined()) return; |
| 73 | this->running.pop_front(); |
| 74 | LinkGraphID id = next->LinkGraphIndex(); |
| 75 | delete next; // implicitly joins the thread |
| 76 | if (LinkGraph::IsValidID(id)) { |
| 77 | LinkGraph *lg = LinkGraph::Get(id); |
| 78 | this->Dequeue(lg); // Dequeue to avoid double-queueing recycled IDs. |
| 79 | this->Queue(lg); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Run all handlers for the given Job. |
no test coverage detected