N
Nick
Dear All,
I have a section of code that is something along the lines of:
private void threadFunc ()
{
while (true)
{
object o = ourOwnQueueObject.GetObject (); // Non blocking.
processObject (o); // Again nothing blocks in this function.
Thread.Sleep (1); // Untighten loop.
}
}
This function is spawned at app start. Abort () is called on this
thread on app close. If, however, abort is called whilst the thread
is sleeping I get an exception (as has been well discussed here and
elsewhere).
I could replace the line 'while (true)' with something like 'while
(keepGoing)' and change keepGoing to false on app close.
Does anybody know any other way to untighten the loop?
Discussion/debate/ideas welcome.
Thanks in advance,
Nick
I have a section of code that is something along the lines of:
private void threadFunc ()
{
while (true)
{
object o = ourOwnQueueObject.GetObject (); // Non blocking.
processObject (o); // Again nothing blocks in this function.
Thread.Sleep (1); // Untighten loop.
}
}
This function is spawned at app start. Abort () is called on this
thread on app close. If, however, abort is called whilst the thread
is sleeping I get an exception (as has been well discussed here and
elsewhere).
I could replace the line 'while (true)' with something like 'while
(keepGoing)' and change keepGoing to false on app close.
Does anybody know any other way to untighten the loop?
Discussion/debate/ideas welcome.
Thanks in advance,
Nick