Subscribe via RSS ... Subscribe via e-mail ... Follow me on Twitter ... Follow me on Facebook ...




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Threading;
 
namespace Threading
{
  public class Program
  {
    static bool mStopThread = false;
 
    protected static void threadFunction()
    {
 
      Console.WriteLine("Inside the thread. ");
      while (mStopThread == false)
      {
        Console.Write("." );
        Thread.Sleep(400);
      }
    }
 
 
    static void Main(string[] args)
    {
      Thread lThread = new Thread(new ThreadStart(threadFunction));
 
      lThread.Start();
      Thread.Sleep(5000);
      mStopThread = true;
      lThread.Join();
    }
  }
}