this is my Problem :
I have a stack of threads , each thread will do its job and then return to the stack
at the first time the thread is working well
after it finishes the job if I want to pop it from the stack
to run again : Exception will appear which said this thread is running or terminated can’t be restarted ….
is it allowed to run the thread more than one time ??
thanks …
this is my Problem : I have a stack of threads , each thread
Share
Sounds to me like you’re trying to implement your own thread pool. Try using System.Threading.ThreadPool instead.
Next, convert your
Stack{Thread}to aStack{Action}. Pop items off the stack, run them using the built-in threadpool, then return items to the stack as needed.