Hello, I have this class. but when I call Start() on it the Run method is never called.
Am I doing something wrong?
public class ThreadedJob
{
public bool m_IsDone = false;
private Thread m_Thread = null;
private Action action ;
public ThreadedJob(Action runAction)
{
this.action = runAction;
}
public void Start()
{
m_Thread = new Thread(this.Run);
m_Thread.Start();
}
public void Abort()
{
m_Thread.Abort();
}
private void ThreadFunction() {
action();
}
private void Run()
{
while(true){
Debug.Log("Thread Function Called");
ThreadFunction();
System.Threading.Thread.Sleep(500);
}
}
}