A
Annette Miller
I use Thread.Sleep to cause my background threads to for 500ms. The
structure of the thread is:
do
{
...
-- code --
...
Thread.Sleep(500);
} while (!closing)
Now my problem is that occassionally when my application is exiting it just
hangs and won't close. In my FormClosing event I have the following code:
closing = true;
backgroundThread.Interrupt();
backgroundThread.Abort();
But it doesn't seem to stop the problem. And when the background thread
doesn't sleep the problem doesn't occur, but its not an option because CPU
usage is high if it doesn't sleep.
How do I fix this?
Cheers...
structure of the thread is:
do
{
...
-- code --
...
Thread.Sleep(500);
} while (!closing)
Now my problem is that occassionally when my application is exiting it just
hangs and won't close. In my FormClosing event I have the following code:
closing = true;
backgroundThread.Interrupt();
backgroundThread.Abort();
But it doesn't seem to stop the problem. And when the background thread
doesn't sleep the problem doesn't occur, but its not an option because CPU
usage is high if it doesn't sleep.
How do I fix this?
Cheers...