forked from mirror/OpenTTD
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.
This commit is contained in:
committed by
Patric Stout
parent
9a45a0f535
commit
0c5dc5d41e
@@ -11,6 +11,7 @@
|
||||
#include "../linkgraph/linkgraph.h"
|
||||
#include "../linkgraph/linkgraphjob.h"
|
||||
#include "../linkgraph/linkgraphschedule.h"
|
||||
#include "../network/network.h"
|
||||
#include "../settings_internal.h"
|
||||
#include "saveload.h"
|
||||
|
||||
@@ -245,6 +246,10 @@ void AfterLoadLinkGraphs()
|
||||
}
|
||||
|
||||
LinkGraphSchedule::instance.SpawnAll();
|
||||
|
||||
if (!_networking || _network_server) {
|
||||
AfterLoad_LinkGraphPauseControl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user