C# - Notify result from one thread to another or wait for feedback from the first thread to continue the second thread
===

I am trying to get 2 threads running in the background to perform tasks. I have to create the threads sequentially and proceed with the program execution. But the second thread must execute it's work only when the first finishes.

Here is the sample:


	class Program
	{

		static string outValue;
		static bool _isFinished = false;

		static void Main(string[] args)
		{
			ThreadStart thread1 = delegate()
			{
				outValue = AnotherClass.FirstLongRunningTask();
				// I need to set the _isFinished after the long running finishes..
				// I cant wait here because I need to kick start the next thread and move on.
				// 
			};
			new Thread(thread1).Start();
			
			ThreadStart thread2 = delegate()
			{
				while (!_isFinished)
				{
					Thread.Sleep(1000);
					Console.WriteLine("Inside the while loop...");
				}
				if (!string.IsNullOrEmpty(outValue))
				{
					// This should execute only if the _isFinished is true...
					AnotherClass.SecondTask(outValue);	
				}
				
			};
			new Thread(thread2).Start();

			for (int i = 0; i < 5000; i++)
			{
				Thread.Sleep(500);
				Console.WriteLine("I have to work on this while thread 1 and thread 2 and doing something ...");	
			}	
			Console.ReadLine();

		}



	}


	public class AnotherClass
	{
		public static string FirstLongRunningTask() 
		{
			Thread.Sleep(6000);
			return "From the first long running task...";
		}

		public static void SecondTask(string fromThread1) 
		{
			Thread.Sleep(1000);
			Console.WriteLine(fromThread1);
		}
	}


Where do I set the _isFinished?  
I can't use BackgroundWorker threads. Any help is appreciated.
