问题描述
没有函数模板 ThreadPool::enqueue
的实例匹配参数列表——参数类型是:(void (shih_tzu::AuthCtl::AuthController::)(void *Arg),void *)
线程池.h
template<typename F,typename...Args>
auto ThreadPool::enqueue(F&& f,Args&&... args) -> std::future<decltype(f(args...))>
{
std::function<decltype(f(args...))() > func = std::bind(std::forward<F>(f),std::forward<Args>(args)...);
auto task_ptr = std::make_shared < std::packaged_task<decltype(f(args...))()>>(func);
std::function<void() > wrapper_func = [task_ptr]()
{
(*task_ptr)();
};
mTasks.emplace(wrapper_func);
debugLog->PrintLog("Inside Thread pool enqueue function insert new function call\n");
cv.notify_one();
return task_ptr->get_future();
}
调用入队
thread_pool->enqueue(&AuthController::WorkerFunction,(void *)sThreadStruct1); //error here
WorkerFunction 签名:-
void* AuthController::WorkerFunction(void *Arg)
请帮我解决这个编译时问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)