How to create a new process thread and stop it?
Sapna
Class ThreadExample{
static void Main(String[] args)
{
ThreadExample example= new ThreadExample();
Thread Message1= new Thread(New ThreadStart(example.DisplayMessage));
Thread Message2= new Thread(New ThreadStart(example.DisplayMessage2));
// to start a thread1
Message1.Start()
// to start a thread2
Message2.Start()
// There should not be option to stop a Thread
//but possiblt to suspend a thread using Suspend Property,It will not do anything if
//thread execution gets completed
}
public void DisplayMessage()
for(int i=0;i<20;i++)
Console.writeLine(i)
public void DisplayMessage2()
for(int i=21;i<40;i++)