MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / JoinNext

Method JoinNext

src/linkgraph/linkgraphschedule.cpp:68–81  ·  view source on GitHub ↗

* Join the next finished job, if available. */

Source from the content-addressed store, hash-verified

66 * Join the next finished job, if available.
67 */
68void 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.

Callers 1

OnTick_LinkGraphFunction · 0.80

Calls 5

DequeueMethod · 0.95
QueueMethod · 0.95
IsScheduledToBeJoinedMethod · 0.80
LinkGraphIndexMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected