44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using PDFGenerator.BusinessLayer;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GestorePDF.Logic
|
|
{
|
|
class MasterThread
|
|
{
|
|
public static ConcurrentQueue<DataThread> ThreadsQueue = new ConcurrentQueue<DataThread>();
|
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
public static void ProcessDataInSingleThread()
|
|
{
|
|
while (ThreadsQueue.Count > 0)
|
|
{
|
|
try
|
|
{
|
|
DataThread dataThread = null;
|
|
ThreadsQueue.TryDequeue(out dataThread);
|
|
if (dataThread != null)
|
|
{
|
|
GestoreThread gestoreThread = new GestoreThread();
|
|
|
|
gestoreThread.DoWork(dataThread);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
try {
|
|
logger.Error(ex.Message);
|
|
}
|
|
catch { }
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
Thread.Sleep(50);
|
|
}
|
|
}
|
|
}
|
|
}
|