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

Method SpawnNext

src/linkgraph/linkgraphschedule.cpp:33–52  ·  view source on GitHub ↗

* Start the next job in the schedule. */

Source from the content-addressed store, hash-verified

31 * Start the next job in the schedule.
32 */
33void LinkGraphSchedule::SpawnNext()
34{
35 if (this->schedule.empty()) return;
36 LinkGraph *next = this->schedule.front();
37 LinkGraph *first = next;
38 while (next->Size() < 2) {
39 this->schedule.splice(this->schedule.end(), this->schedule, this->schedule.begin());
40 next = this->schedule.front();
41 if (next == first) return;
42 }
43 assert(next == LinkGraph::Get(next->index));
44 this->schedule.pop_front();
45 if (LinkGraphJob::CanAllocateItem()) {
46 LinkGraphJob *job = new LinkGraphJob(*next);
47 job->SpawnThread();
48 this->running.push_back(job);
49 } else {
50 NOT_REACHED();
51 }
52}
53
54/**
55 * Check if the next job is supposed to be finished, but has not yet completed.

Callers 1

OnTick_LinkGraphFunction · 0.80

Calls 7

NOT_REACHEDFunction · 0.85
SpawnThreadMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
SizeMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected