another question on setting up multi threads.

G

Guest

Hi I have the code below and am trying to learn how to set up 2 threads and
have 1 thread wait for the completion of another thread. Just wondering or
there any simple examples, thought for one thread I would just use a loop and
when this loop ends have the second thread start to execute. The code I have
so far is minimal. I have a write to console start thread in the member that
is called for the thread start but this does not seem to executed.

using System;
namespace ConsoleApplication1
{
{
static void Main(string[] args)
{
System.Threading.Thread myThread;
start_thread start_thread_inst = new start_thread() ;
myThread = new System.Threading.Thread(new
System.Threading.ThreadStart(start_thread_inst.start ));//calling the start
method of class start_thread
myThread.Start() ;

}
}
}
In the class file I have
using System;
namespace ConsoleApplication1
class start_thread
{
public void start(){Console.WriteLine("start_thread");}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top