Add Unity3D projects

This commit is contained in:
2024-03-09 19:25:59 +00:00
parent 1c71f24fab
commit 829289c881
4626 changed files with 441247 additions and 0 deletions

View File

@ -0,0 +1,67 @@
namespace RoadArchitect.Threading
{
public class ThreadedJob
{
private bool isDone = false;
private object handle = new object();
private System.Threading.Thread thread = null;
public bool IsDone
{
get
{
bool tmp;
lock (handle)
{
tmp = isDone;
}
return tmp;
}
set
{
lock (handle)
{
isDone = value;
}
}
}
public virtual void Start()
{
thread = new System.Threading.Thread(Run);
thread.Start();
}
public virtual void Abort()
{
thread.Abort();
}
protected virtual void ThreadFunction() { }
protected virtual void OnFinished() { }
public virtual bool Update()
{
if (IsDone)
{
OnFinished();
return true;
}
return false;
}
private void Run()
{
ThreadFunction();
IsDone = true;
}
}
}