Proper checking if lua is running when doing thread waiting/set

This commit is contained in:
andres.delikat 2012-01-28 22:00:51 +00:00
parent 0082876510
commit 2e0ac111ab
3 changed files with 26 additions and 3 deletions

View File

@ -32,6 +32,7 @@ namespace BizHawk.MultiClient
public void Close()
{
lua.Close();
LuaWait.Dispose();
}
public void LuaRegister(Lua lua)

View File

@ -1620,12 +1620,12 @@ namespace BizHawk.MultiClient
if (runFrame)
{
//client input-related duties
if (LuaConsole1.LuaImp.isRunning)
if (LuaConsole1.IsRunning())
{
LuaConsole1.LuaImp.LuaWait.WaitOne();
LuaConsole1.WaitOne();
}
if (LuaConsole1.LuaImp.isRunning)
if (LuaConsole1.IsRunning())
{
Global.MainForm.MainWait.Set();
}

View File

@ -646,5 +646,27 @@ namespace BizHawk.MultiClient
OpenLuaSession();
}
public bool IsRunning()
{
if (!this.IsHandleCreated || this.IsDisposed)
{
return false;
}
else
{
if (LuaImp.isRunning)
return true;
else
return false;
}
}
public void WaitOne()
{
if (!this.IsHandleCreated || this.IsDisposed)
return;
this.LuaImp.LuaWait.WaitOne();
}
}
}