14 #ifndef DRCE_ASYNC_TASKS_QUEUE_HPP
15 #define DRCE_ASYNC_TASKS_QUEUE_HPP
19 #include <Poco/SharedPtr.h>
20 #include <Poco/Observer.h>
21 #include <Poco/Task.h>
22 #include <Poco/Thread.h>
23 #include <Poco/Mutex.h>
24 #include <Poco/ThreadPool.h>
25 #include <Poco/TaskManager.h>
26 #include <Poco/TaskNotification.h>
39 class DRCEAsyncTasksQueue;
40 class DRCEResultDataItem;
50 void onStarted(Poco::TaskStartedNotification* pNf);
51 void onFinished(Poco::TaskFinishedNotification* pNf);
52 void onCancelled(Poco::TaskCancelledNotification* pNf);
54 static void log(
const std::string& msg);
65 unsigned int parentTaskId_,
67 unsigned int timeMax_,
96 enum {DEFAULT_MAX_CAPACITY=16};
97 enum {DEFAULT_QUEUE_DUMP_PERIOD=10000};
99 typedef std::map<unsigned int, AsyncTasks>
Tasks;
100 typedef std::map<unsigned int, std::map<unsigned int, bool> >
SubTasks;
110 void startTask(Poco::Task* pTask)
throw (Poco::Exception);
168 void addSubtask(
unsigned int taskId,
unsigned int subtaskId,
bool needCleanup);
177 unsigned int maxThreadCount;
178 Poco::ThreadPool threadPool;
179 Poco::TaskManager taskManager;
189 volatile bool terminated;
190 unsigned int tasksQueueDumpPeriod;
192 Poco::TaskManager cleanupTaskManager;
195 bool resetErrorCodeStateNotification;
216 #endif // DRCE_ASYNC_TASKS_QUEUE_HPP