how to reinitialize a while loop running in a worker thread

Posted on 2009-04-23
Medium Priority
Last Modified: 2013-12-17
hi -- I'm running a while loop in a worker thread -- polling for receive data from a custom board. I want to terminate the while loop when errors get excessive but then re-enter the loop when I'v e fixed the problem. Do I abort the thread, then restart it? There seems there should be a better way. Suspend and resume don't seem to work (and they've been deprecated).
i'm using C# and VS2008 with dot.net 3.5.
Question by:jdcoburn
1 Comment
LVL 26

Accepted Solution

Anurag Thakur earned 1500 total points
ID: 24222309
Thread.Resume has been deprecated.
Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  http://go.microsoft.com/fwlink/?linkid=14202

similarly suspending will also work like this
else you can try to make the thread sleep for a certain amount of time

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question