0

I am trying to initiating multiple threads into one thread.

public class TestForm
{
      int samleLoopCounter = 3;
      public TestForm()
      {
            Thread CreateProcessInfoThread = new Thread(new ThreadStart(ProcessOrders));
            CreateProcessInfoThread.Start();
      }

      void ProcessOrders()
      {
            for (int orderCounter = 0; orderCounter < samleLoopCounter; orderCounter++)
            {
                  EntryPoint obj = new EntryPoint();
                  Thread process = new Thread(obj.Start);
                  process.Start();
            }
      }
}

public class EntryPoint
{
     // No of variable and properties declared here
     ....
     ....

     public void Start()
     {
          // No of Private methods has been calling inside
          ....
          ....
     }
}

I have created new instance of EntryPoint class every time into loop of ProcessOrders() method and start processing thread, but I'm still getting error inside the Start() method of EntryPoint class at many location related to resource in use Or I'm getting error related to null reference, may be because another thread has already disposed it.

So the main question is, Does all process threads are accessing same variable and memory of EntryPoint class, even though I have created new instance of EntryPoint class? I'm quite confuse with these.

Harshad Vekariya
  • 972
  • 1
  • 7
  • 28

0 Answers0