I am writing code for threadpool and after compiling it give me error
no instance of function template "ThreadPool::enqueue" matches the argument list -- argument types are: (void (shih_tzu::AuthCtl::AuthController::)(void *Arg), void *)
Threadpool.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(); }
Calling enqueue
thread_pool->enqueue(&AuthController::WorkerFunction,(void *)sThreadStruct1); //error here
WorkerFunction signature:- void* AuthController::WorkerFunction(void *Arg)
please help me to resolve this compile-time issue.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire