Running one thread multiple times

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm new to threading, and I need some beginner help. I have a thread that
successfully runs and then terminates. I want to run it a second time, but
doing myThread.Start() again brings an unhandled exception saying, "Thread is
running or terminated; it can not restart." (Note: I've checked the status
of the thread at this point and it is indeed "Stopped.") There must be
another way to go about this?

Thanks,
Nathan
 
Nathan said:
Hi,

I'm new to threading, and I need some beginner help. I have a thread that
successfully runs and then terminates. I want to run it a second time, but
doing myThread.Start() again brings an unhandled exception saying, "Thread is
running or terminated; it can not restart." (Note: I've checked the status
of the thread at this point and it is indeed "Stopped.") There must be
another way to go about this?

Thanks,
Nathan

AFAIK, You can not rerun the same thread. You need to create the thread
again using "MyThread = New Thread"

Add the code that creates the thread to your loop and see if that solves
the problem for you.

Chris
 

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

Back
Top