using System;
using System.Threading;
// csc thread_IsAilve_Abort.cs
namespace ex_threading
{
public class thread_state
{
public thread_state() { Console.WriteLine("Thread Constructor "); Thread.Sleep(3000); }
public static void process() { Console.WriteLine(Thread.CurrentThread.Name.ToString());
p_string("hello");
p_number(25);
}
public static void p_string(string str1) {
Console.Write(Thread.CurrentThread.Name.ToString());
string str = str1;
Console.WriteLine(": string " + str + " processed at: "+ DateTime.Now);}
private static void p_number(int n3) {
int ni = n3;
Console.Write(Thread.CurrentThread.Name.ToString());
Console.WriteLine(": Number " + ni + " processed at : "+ DateTime.Now);}

}//end of class thread_state
class test
{
static void Main()
{
DateTime dt = DateTime.Now;
Console.WriteLine("Object is being created {0} ", dt);
thread_state ts = new thread_state();
Console.WriteLine("Back to Main");
DateTime dt2 = DateTime.Now;
Console.WriteLine("Time lapsed {0} ", dt2);
Thread str = new Thread(thread_state.process);
str.Name = "Job Handler";
//p_string("process string" );
str.Start();
string str_killed = str.Name ;
Console.ReadLine();
str.Abort();
if(!str.IsAlive){ Console.WriteLine("Thread " + str_killed + " is terminated"); }
Console.ReadLine();
}
}//endo of class test

}//end of namespace