If i have endless loop while(true) how can i use an outside flag to stop/continue the loop?
<p>what i need to do is to add a button or two with a flag that will stop/continue the loop.
How can i do it ?    </p>

<pre><code>private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
    while(true)
    {
        cpuView();
        gpuView();
        Thread.Sleep(1000);
    }
}
</code></pre>
