]> git.lizzy.rs Git - dragonblocks3d.git/blobdiff - src/async_mgr.hpp
New structure
[dragonblocks3d.git] / src / async_mgr.hpp
diff --git a/src/async_mgr.hpp b/src/async_mgr.hpp
new file mode 100644 (file)
index 0000000..a62be0d
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <mutex>
+#include <thread>
+#include <vector>
+
+namespace dragonblocks
+{
+       class AsyncMgr : public std::thread
+       {
+               public:
+               class ITask
+               {
+                       public:
+                       virtual void doAsyncTask();
+               };
+               
+               void addTask(ITask *);
+               void run();
+               void start();
+                               
+               private:
+               std::mutex mtx;
+               std::vector<ITask *> queued_jobs;
+               std::thread async_thread;
+       };
+}