Fixes
This commit is contained in:
+4
-4
@@ -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)
|
||||
|
||||
+8
-21
@@ -13,35 +13,22 @@ namespace hqueue {
|
||||
std::is_invocable_v<T>;
|
||||
};
|
||||
|
||||
template<executor_t executor>
|
||||
template<executor_t executor, typename cache_entry_t>
|
||||
class queue {
|
||||
public:
|
||||
using return_type = typename function_traits<executor_t>::return_type;
|
||||
using arguments = typename function_traits<executor_t>::argument_types;
|
||||
|
||||
template<typename R, typename Args>
|
||||
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<std::jthread> m_threads;
|
||||
std::mutex m_mtx;
|
||||
std::condition_variable m_cv;
|
||||
|
||||
}
|
||||
executor m_executor;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user