private void Work(string logValue) //multi threaded
{
ThreadContext.Properties[Config.LogKey] = logValue;
string url = string.Empty;
while (true)
{
lock (UrlLock)
{
if (Urls.Count > 0)
{
url = Urls.Dequeue();
}
else
{
url = null;
}
}
if (url == null) //nothing left in queue
{
break;
}
_runtime.Call(_line);
var downloadResult = Http.DownloadPage(_runtime, url, _line);
_runtime.Call(_line);
if (_callOnProgres)
{
_runtime.OnProgress();
}
lock (ResultLock)
{
foreach (var p in downloadResult)
{
_results.Enqueue(p);
}
}
}
}