how to restart the thread
-
Hi, I am using threading concept in my application to fetch the image form the video server and display. the code is: for (int i = 0; i < dataCount; i++) { doneEvents[i] = new ManualResetEvent(false); ImageReader imgr = new ImageReader(doneEvents[i]); objImageReader[i] = imgr; WaitCallback callback = delegate(object state) { imgr.DownloadFile((structCameraServer)state); }; ThreadPool.QueueUserWorkItem(callback, objServer[i]); } WaitHandle.WaitAll(doneEvents); but how to call the thread again after completion of the work (ie how to make the thread to start again). Thanks in advance,
-
Hi, I am using threading concept in my application to fetch the image form the video server and display. the code is: for (int i = 0; i < dataCount; i++) { doneEvents[i] = new ManualResetEvent(false); ImageReader imgr = new ImageReader(doneEvents[i]); objImageReader[i] = imgr; WaitCallback callback = delegate(object state) { imgr.DownloadFile((structCameraServer)state); }; ThreadPool.QueueUserWorkItem(callback, objServer[i]); } WaitHandle.WaitAll(doneEvents); but how to call the thread again after completion of the work (ie how to make the thread to start again). Thanks in advance,
-
renuga5298 wrote:
how to make the thread to start again
new Thread( ... )
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 beta 1 - out now!
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))assume like i have 10 threads intially, if i am restarting again with the new thread(...) wont the thread count be increased to 20 and when the number of the thread increases it may create probelm as i need to do this functionality for every 1 sec time interval.
-
Hi, I am using threading concept in my application to fetch the image form the video server and display. the code is: for (int i = 0; i < dataCount; i++) { doneEvents[i] = new ManualResetEvent(false); ImageReader imgr = new ImageReader(doneEvents[i]); objImageReader[i] = imgr; WaitCallback callback = delegate(object state) { imgr.DownloadFile((structCameraServer)state); }; ThreadPool.QueueUserWorkItem(callback, objServer[i]); } WaitHandle.WaitAll(doneEvents); but how to call the thread again after completion of the work (ie how to make the thread to start again). Thanks in advance,
renuga5298 wrote:
but how to call the thread again after completion of the work (ie how to make the thread to start again).
Use
Thread
class other thanThreadPool
. Don't end the thread when operation completes. Write your code in a loop and when each cycle completes, sleep for some time.Navaneeth How to use google | Ask smart questions
-
renuga5298 wrote:
but how to call the thread again after completion of the work (ie how to make the thread to start again).
Use
Thread
class other thanThreadPool
. Don't end the thread when operation completes. Write your code in a loop and when each cycle completes, sleep for some time.Navaneeth How to use google | Ask smart questions
Can you please guide me in using the thread class for this scenario as i am new to threading
-
Can you please guide me in using the thread class for this scenario as i am new to threading
If your firing a thread off ever second, I would suggest the BackgroundWorker its a lot easier to manage. You could check if its busy on each Tick and fire it off again if not.
A craft is an enemy if not well learned.