private void SecondaryThread()
{
try
{
while (Run)
{
bool sleep;
if (PendingArticles.Count > 0) lock (PendingArticles)
{
if (PendingArticles.Count > 0)
{
ArticleInfo ai = PendingArticles.Remove();
ScanArticle(ai);
sleep = false;
}
else
sleep = true;
}
else
sleep = true;
if (sleep)
Thread.Sleep(1);
}
}
catch (ThreadAbortException)
{ }
catch (Exception ex)
{
ErrorHandler.HandleException(ex);
}
}