Skip to content

Commit 94277ad

Browse files
committed
Automatic merge of T1.6-126-gc9409918f and 13 pull requests
- Pull request #1082 at 8538170: Allow variable water level in glass gauge - Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window - Pull request #1091 at 492795a: Automatic speed control - Pull request #1122 at b9b077b: Wagon Size and Centering Controls - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1128 at d116396: Particle Emitter Overhaul - Pull request #1157 at 39cd994: Dynamic brake authorization by TCS - Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler - Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9. - Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci. - Pull request #1165 at aacd11b: docs: Add code guidelines for logging - Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures - Pull request #1167 at 2c028a4: Fix: RunActivity slow to terminate because of long sleep in Host Process
15 parents 7b4c1a4 + c940991 + 8538170 + f46d5f2 + 492795a + b9b077b + e241a0d + d116396 + 39cd994 + 48c9a63 + 2f9e292 + 1ad9889 + aacd11b + 51e7f7a + 2c028a4 commit 94277ad

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Source/RunActivity/Viewer3D/Processes/HostProcess.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2022 by the Open Rails project.
1+
// COPYRIGHT 2022 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -62,7 +62,9 @@ public class HostProcess
6262
readonly Game Game;
6363
readonly Thread Thread;
6464

65-
private const int SleepTime = 10000;
65+
private const int DoHostTime = 10000;
66+
private const int SleepTime = 100; // must be short enough for timely termination
67+
private const uint DoHostIntervall = DoHostTime / SleepTime;
6668

6769
public HostProcess(Game game)
6870
{
@@ -91,13 +93,18 @@ void HostThread()
9193
GlobalMemoryStatusEx(memoryStatus);
9294
CPUMemoryVirtualLimit = Math.Min(memoryStatus.TotalVirtual, memoryStatus.TotalPhysical);
9395

96+
uint sleepCount = 0;
9497
while (true)
9598
{
9699
Thread.Sleep(SleepTime);
97100
if (State.Terminated)
98101
break;
99-
if (!DoHost())
100-
return;
102+
if (sleepCount % DoHostIntervall == 0)
103+
{
104+
if (!DoHost())
105+
return;
106+
}
107+
sleepCount++;
101108
}
102109
}
103110

0 commit comments

Comments
 (0)