-
Notifications
You must be signed in to change notification settings - Fork 1k
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
task::arena::execute is not compatible with move-only functors #16
Comments
Hi Anton! Thank you for the reported problem. I could not reproduce the problem with If using move-only objects is critical, you may want to use the following work-around: tbb::task_arena{}.enqueue(
+ [l = new auto(
[p = std::unique_ptr<int>(new int)]() {
*p = 1;
}
+ )] { l->operator()(); delete l; }
); Regards, |
IMHO, the work-around is not functional when cancellation appears, and in this particular case leads to memory leak, as |
Let me improve it a bit: tbb::task_arena{}.enqueue(
+ [l = [](auto&& p) { typedef typename std::decay<decltype(p)>::type T; return std::make_shared<T>(std::forward<T>(p)); } (
[p = std::unique_ptr<int>(new int)]() {
*p = 1;
}
+ )] { (*l)(); }
); |
Hi Anton, We released fix for your issue and would like you to confirm that it works as you wished. Thanks! |
both
task::arena::execute
andtask::arena::enqueue
require it argument to be copyable. So following code simply wont compile:The text was updated successfully, but these errors were encountered: