-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide example for using class functions #1
Comments
It can be done combination of these two exapmles. p.push(third, "additional_param");
p.push( [] (int id){ std::cout << "hello from " << id << '\n'; });
//Like this:
struct Hello
{
void print(int id) {std::cout<<"Hello from:"<<id<<std::endl;}
}
Hello hello;
p.push([](int id, Hello* hello){ hello->print(id);}, &hello); |
you can pass the pointer to the class in the labda capture clause.
then a different overload of the threadpool push function is used. This overload is better because it does not use std::bind and hence does less copy constructions of parameters.
|
Thank you, lambda functions are still quite new for me. |
Hi,
can you provide example how to use threadpool to call member function?
The text was updated successfully, but these errors were encountered: