How to manage threads?

  • Thread starter Thread starter TOMERDR
  • Start date Start date
T

TOMERDR

Hi,

I have 4 classes(of different type) which each of them span a thread
and i would like to run the thread sequentially(for debug)
in such that the second thread will start only after the
first thread finished

what is the best way to achive it,assuming i would like to be able
to stop the thread after it was started


Thanks in advance
 
TOMERDR said:
I have 4 classes(of different type) which each of them span a thread
and i would like to run the thread sequentially(for debug)
in such that the second thread will start only after the
first thread finished

what is the best way to achive it,assuming i would like to be able
to stop the thread after it was started

It's not entirely clear what you mean, but there are two issues here:

1) Running four tasks in sequence
2) Stopping a thread

The second point I've written about here:
http://www.pobox.com/~skeet/csharp/threads/shutdown.shtml

For the first point, it would help if you'd give some more detail. Are
you actually creating four threads? If so, do you have to, or could you
just run a single thread which calls the four different
ThreadStart-comptaible methods in turn?

If you really are starting four threads and feel you have to, you could
make each thread call Join on the "previous" one, which should have
roughly the same effect.
 
Back
Top