Remove timeouts when waiting for game state changes
This commit is contained in:
@@ -334,7 +334,7 @@ namespace Torch
|
|||||||
|
|
||||||
Managers.GetManager<PluginManager>().LoadPlugins();
|
Managers.GetManager<PluginManager>().LoadPlugins();
|
||||||
Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, Config.InstancePath, RunArgs);
|
Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, Config.InstancePath, RunArgs);
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Stopped, TimeSpan.FromMinutes(5)))
|
if (!Game.WaitFor(VRageGame.GameState.Stopped))
|
||||||
Log.Warn("Failed to wait for game to be initialized");
|
Log.Warn("Failed to wait for game to be initialized");
|
||||||
Managers.Attach();
|
Managers.Attach();
|
||||||
_init = true;
|
_init = true;
|
||||||
@@ -357,7 +357,7 @@ namespace Torch
|
|||||||
{
|
{
|
||||||
Managers.Detach();
|
Managers.Detach();
|
||||||
Game.SignalDestroy();
|
Game.SignalDestroy();
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Destroyed, _gameStateChangeTimeout))
|
if (!Game.WaitFor(VRageGame.GameState.Destroyed))
|
||||||
Log.Warn("Failed to wait for the game to be destroyed");
|
Log.Warn("Failed to wait for the game to be destroyed");
|
||||||
Game = null;
|
Game = null;
|
||||||
}
|
}
|
||||||
@@ -407,7 +407,7 @@ namespace Torch
|
|||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
Game.SignalStart();
|
Game.SignalStart();
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Running, _gameStateChangeTimeout))
|
if (!Game.WaitFor(VRageGame.GameState.Running))
|
||||||
Log.Warn("Failed to wait for the game to be started");
|
Log.Warn("Failed to wait for the game to be started");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ namespace Torch
|
|||||||
{
|
{
|
||||||
LogManager.Flush();
|
LogManager.Flush();
|
||||||
Game.SignalStop();
|
Game.SignalStop();
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Stopped, _gameStateChangeTimeout))
|
if (!Game.WaitFor(VRageGame.GameState.Stopped))
|
||||||
Log.Warn("Failed to wait for the game to be stopped");
|
Log.Warn("Failed to wait for the game to be stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -382,7 +382,7 @@ namespace Torch
|
|||||||
/// <param name="state">State to transition to</param>
|
/// <param name="state">State to transition to</param>
|
||||||
/// <param name="timeout">Timeout</param>
|
/// <param name="timeout">Timeout</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool WaitFor(GameState state, TimeSpan? timeout)
|
public bool WaitFor(GameState state, TimeSpan? timeout = null)
|
||||||
{
|
{
|
||||||
// Kinda icky, but we can't block the update and expect the state to change.
|
// Kinda icky, but we can't block the update and expect the state to change.
|
||||||
if (Thread.CurrentThread == _updateThread)
|
if (Thread.CurrentThread == _updateThread)
|
||||||
|
Reference in New Issue
Block a user