diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d5886..941cc79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.15) -project(mypkg CXX) +project(hqueue CXX) -add_library(mypkg src/mypkg.cpp) -target_include_directories(mypkg PUBLIC include) +add_library(hqueue src/mypkg.cpp) +target_include_directories(hqueue PUBLIC include) -set_target_properties(mypkg PROPERTIES PUBLIC_HEADER "include/mypkg.h") +set_target_properties(hqueue PROPERTIES PUBLIC_HEADER "include/mypkg.h") install(TARGETS mypkg) diff --git a/include/hqueue.hpp b/include/hqueue.hpp index a34789a..36bc543 100644 --- a/include/hqueue.hpp +++ b/include/hqueue.hpp @@ -13,35 +13,22 @@ namespace hqueue { std::is_invocable_v; }; - template + template class queue { public: using return_type = typename function_traits::return_type; using arguments = typename function_traits::argument_types; template - struct Task { - Args args; - //use std expected - } + struct Task { + Args args; + //use std expected + }; - queue(std::uint16_t max_threads, executor_t executor) - : max_threads(max_threads) { - for (int i = 0; i < max_threads; ++i) { - m_threads.push_back([this](){ - { - std::unique_lock lck(m_mtx); - m_cv.wait(lck, [](){ return true; }); - } - - }); - } - } + queue(executor exec) : m_executor(exec) { } private: - std::uint16_t max_threads; - std::vector m_threads; std::mutex m_mtx; std::condition_variable m_cv; - - } + executor m_executor; + }; } diff --git a/internal/lambda_traits.hpp b/include/internal/lambda_traits.hpp similarity index 100% rename from internal/lambda_traits.hpp rename to include/internal/lambda_traits.hpp