diff --git a/Backend/include/EasyContact/DispatchQueue.hpp b/Backend/include/EasyContact/DispatchQueue.hpp index 26ca209f..b0630340 100644 --- a/Backend/include/EasyContact/DispatchQueue.hpp +++ b/Backend/include/EasyContact/DispatchQueue.hpp @@ -11,36 +11,77 @@ // C++ Standard Library #include #include -#include #include -#include #include // Standard Template Library #include #include #include -// EasyContact Header Files -#include class DispatchQueue { - typedef std::function Functor; + using Functor = std::function; private: + bool inServices; size_t JobID; std::mutex Lock; std::vector Threads; std::queue Queue; std::condition_variable CV; - bool inServices = true; + + protected: void Dispatch_Hander(void); public: + /** + * Default Class Constructor + * @param NumThreads : Number of Threads to Create + */ explicit DispatchQueue(const size_t& NumThreads); + /** + * Default Class Destructor + */ ~DispatchQueue(); + /** + * Add Task to Dispatch Queue + * @param Operation : Task Expressed in Lambda Expression + * @return std::pair : Your Task ID, Number of Tasks Before + * Your Task + */ std::pair Dispatch(const Functor& Operation); + /** + * Add Task to Dispatch Queue + * @param Operation : Task Expressed in Lambda Expression + * @return std::pair : Your Task ID, Number of Tasks Before + * Your Task + */ std::pair Dispatch(Functor&& Operation); + + public: + /** + * This Funtion Call Is Not Allowed & + * Will Delete Left Hand Side Instance + * @param RHS : Another Instance of Current Class + */ DispatchQueue(const DispatchQueue& RHS) = delete; + /** + * This Funtion Call Is Not Allowed & + * Will Delete Left Hand Side Instance + * @param RHS : Another Instance of Current Class + * @return DispatchQueue : Reference to SELF + */ DispatchQueue& operator=(const DispatchQueue& RHS) = delete; + /** + * This Funtion Call Is Not Allowed & + * Will Delete Left Hand Side Instance + * @param RHS : Another Instance of Current Class + */ DispatchQueue(DispatchQueue&& RHS) = delete; + /** + * This Funtion Call Is Not Allowed & + * Will Delete Left Hand Side Instance + * @param RHS : Another Instance of Current Class + * @return DispatchQueue : Reference to SELF + */ DispatchQueue& operator=(DispatchQueue&& RHS) = delete; }; #endif // BACKEND_INCLUDE_EASYCONTACT_DISPATCHQUEUE_HPP_ diff --git a/Backend/src/DispatchQueue.cpp b/Backend/src/DispatchQueue.cpp index 37f97c62..1d39eb75 100644 --- a/Backend/src/DispatchQueue.cpp +++ b/Backend/src/DispatchQueue.cpp @@ -6,9 +6,11 @@ */ #ifndef BACKEND_SRC_DISPATCHQUEUE_CPP_ #define BACKEND_SRC_DISPATCHQUEUE_CPP_ +// EasyContact Header Files #include +#include DispatchQueue::DispatchQueue(const size_t& NumThreads) - : JobID(0), Threads(NumThreads) { + : inServices(true), JobID(0), Threads(NumThreads) { for (size_t i = 0; i < Threads.size(); ++i) { Threads[i] = std::thread(&DispatchQueue::Dispatch_Hander, this); }