Problem in creating Threads
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Problem in creating Threads

Threaded View

  1. #1
    Join Date
    Jan 2012
    Location
    India
    Posts
    138

    Problem in creating Threads

    Hi ,

    I am trying to create and test a Thread ..

    Using a code from tutorial ..

    Code:
    namespace ThreadTry
    {
           class Program
           {
    
                    static void Main(string[] args)
    
                    Thread t = new Thread(WriteY); // create thread
    
                    t.Start(); // start thread
                            
                    for (int i = 0; i < 500; i++) Console.Write('S');
                
                
                   for (; ; )
                   {
                            Console.Write('M');
                           // Infinite loop to check thread occurance          
                   }
                
           
    
                  static void WriteY()
                  {
                              Console.WriteLine("    YYYYYYYY   ");
                
                  }
           }
    }

    I need continuously running thread till my application Runs.
    This is just a test program.
    But the thread t is not continuous. It stops after 1/2 r occurances.

    I am using visual C# express 2010 and unable to use Resume .

    Pl guide me , where is the problem. ?

    Thanking you ..
    Last edited by Arjay; May 3rd, 2013 at 11:59 AM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center