how to reinitialize a while loop running in a worker thread

Posted on 2009-04-23
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 3.5.
Question by:jdcoburn
    1 Comment
    LVL 26

    Accepted Solution

    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.

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now