I am using following code.
public void runThread(){
if (System.Diagnostics.Process.GetProcessesByName(\"myThread\").Length == 0)
{
Thread t = new
One easy way is that you could have a flag that indicates if it's running or not. You maybe have to use some lock
if it's some conflicts.
public static bool isThreadRunning = false;
public void runThread()
{
if (!isThreadRunning)
{
Thread t = new Thread(new ThreadStart(go));
t.IsBackground = true;
t.Name = "myThread";
t.Start();
}
else
{
System.Diagnostics.Debug.WriteLine("myThreadis already Running.");
}
}
public void go()
{
isThreadRunning = true;
//My work goes here
isThreadRunning = false;
}