I am trying to find out if a thread ended with Thread.IsAlive and it seems that it doesn't work as expected with mono 0.23. It seems it is working on CVS, at least the code is there. Does the test below work with it? Will somebody incorporate the new code in the next mono release?

Thank you!
using System;
using System.Threading;

namespace test
{

	class test
	{
		static Thread thr1, thr2;

		static void Main(string[] args)
		{

				thr1 = new Thread (new ThreadStart (threadfunc));
				thr1.Start ();
				thr2 = new Thread (new ThreadStart (threadfunc2));
				thr2.Start ();
		}

		static void threadfunc () 
		{
			int i = 0;
			while (i<2)
			{
				Thread.Sleep(1000);
				i++;
			}

		}

		static void threadfunc2 () 
		{
			int i = 0;
			while (i<4)
			{
				if (thr1 != null && thr1.IsAlive)
					Console.WriteLine("thr1 rnning");
				else
					Console.WriteLine ("thr1 is not running");

				Thread.Sleep (1000);
				i++;
			}
		}
	}
}
--
Pablo Baena <[EMAIL PROTECTED]>

Reply via email to