32 lines
833 B
C#
32 lines
833 B
C#
|
namespace Thousandto.Update.Download
|
|||
|
{
|
|||
|
using Thousandto.Update.Data;
|
|||
|
using Thousandto.Update.Delegate;
|
|||
|
using System;
|
|||
|
|
|||
|
public class ThreadMapDataPool : ThreadPool<MapFileData>
|
|||
|
{
|
|||
|
public ThreadMapDataPool(int maxThreadCount, ThreadPoolAction<MapFileData> action) : base(maxThreadCount, action)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public override MapFileData PopData()
|
|||
|
{
|
|||
|
lock (base._lockObj)
|
|||
|
{
|
|||
|
MapFileData data = base.PopData();
|
|||
|
while ((data != null) && (data.Downloading || data.Downloaded))
|
|||
|
{
|
|||
|
data = base.PopData();
|
|||
|
}
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
data.Downloading = true;
|
|||
|
}
|
|||
|
return data;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|