Pause the game instead of blocking when link graph jobs lag.
Check if the job is still running one date fract tick before it is due to join and if so pause the game until its done. This avoids the main thread being blocked on a thread join. 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:
@@ -63,6 +63,7 @@ protected:
|
||||
Date join_date; ///< Date when the job is to be joined.
|
||||
NodeAnnotationVector nodes; ///< Extra node data necessary for link graph calculation.
|
||||
EdgeAnnotationMatrix edges; ///< Extra edge data necessary for link graph calculation.
|
||||
bool job_completed; ///< Is the job still running. This is accessed by multiple threads and is permitted to be spuriously incorrect.
|
||||
|
||||
void EraseFlows(NodeID from);
|
||||
void JoinThread();
|
||||
@@ -267,13 +268,15 @@ public:
|
||||
* settings have to be brutally const-casted in order to populate them.
|
||||
*/
|
||||
LinkGraphJob() : settings(_settings_game.linkgraph), thread(NULL),
|
||||
join_date(INVALID_DATE) {}
|
||||
join_date(INVALID_DATE), job_completed(false) {}
|
||||
|
||||
LinkGraphJob(const LinkGraph &orig);
|
||||
~LinkGraphJob();
|
||||
|
||||
void Init();
|
||||
|
||||
bool IsJobCompleted() const;
|
||||
|
||||
/**
|
||||
* Check if job is supposed to be finished.
|
||||
* @return True if job should be finished by now, false if not.
|
||||
|
Reference in New Issue
Block a user