summaryrefslogtreecommitdiff
path: root/src/linkgraph/linkgraphschedule.h
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2019-01-22 18:31:08 +0000
committerPatric Stout <github@truebrain.nl>2020-12-22 15:17:57 +0100
commit0c5dc5d41eff0ac0a62dd67882a718bb3c99ec3a (patch)
treeae5c1cb8322cd28fa627f942fb93d59f5029cfe3 /src/linkgraph/linkgraphschedule.h
parent9a45a0f535e312cd97db12c3a2ec1068fa381136 (diff)
downloadopenttd-0c5dc5d41eff0ac0a62dd67882a718bb3c99ec3a.tar.xz
Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)
Check if the job is still running two date fract ticks before it is due to join, and if so pause the game until its done. When loading a game, check if the game would block immediately due to a job which is scheduled to be joined within two date fract ticks, and if so pause the game until its done. This avoids the main thread being blocked on a thread join, which appears to the user as if the game is unresponsive, as the UI does not repaint and cannot be interacted with. Show if pause is due to link graph job in status bar, update network messages. This does not apply for network clients.
Diffstat (limited to 'src/linkgraph/linkgraphschedule.h')
-rw-r--r--src/linkgraph/linkgraphschedule.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linkgraph/linkgraphschedule.h b/src/linkgraph/linkgraphschedule.h
index 62ca2b0c1..6a6dff697 100644
--- a/src/linkgraph/linkgraphschedule.h
+++ b/src/linkgraph/linkgraphschedule.h
@@ -55,6 +55,7 @@ public:
static void Clear();
void SpawnNext();
+ bool IsJoinWithUnfinishedJobDue() const;
void JoinNext();
void SpawnAll();
void ShiftDates(int interval);
@@ -76,4 +77,7 @@ public:
void Unqueue(LinkGraph *lg) { this->schedule.remove(lg); }
};
+void StateGameLoop_LinkGraphPauseControl();
+void AfterLoad_LinkGraphPauseControl();
+
#endif /* LINKGRAPHSCHEDULE_H */