mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 11:19:02 +08:00
Move from rvalue arguments in ThreadPool enqueue* methods
This commit is contained in:
parent
217d839816
commit
9e96e91936
@ -109,26 +109,30 @@ struct ThreadPoolDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Function, class... Args>
|
template <class Function, class... Args>
|
||||||
EIGEN_STRONG_INLINE Notification* enqueue(Function&& f, Args&&... args) const {
|
EIGEN_STRONG_INLINE Notification* enqueue(Function&& f,
|
||||||
|
Args&&... args) const {
|
||||||
Notification* n = new Notification();
|
Notification* n = new Notification();
|
||||||
pool_->Schedule(std::bind(&FunctionWrapperWithNotification<Function, Args...>::run, n, f, args...));
|
pool_->Schedule(
|
||||||
|
std::bind(&FunctionWrapperWithNotification<Function, Args...>::run, n,
|
||||||
|
std::move(f), args...));
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Function, class... Args>
|
template <class Function, class... Args>
|
||||||
EIGEN_STRONG_INLINE void enqueue_with_barrier(Barrier* b,
|
EIGEN_STRONG_INLINE void enqueue_with_barrier(Barrier* b, Function&& f,
|
||||||
Function&& f,
|
|
||||||
Args&&... args) const {
|
Args&&... args) const {
|
||||||
pool_->Schedule(std::bind(
|
pool_->Schedule(
|
||||||
&FunctionWrapperWithBarrier<Function, Args...>::run, b, f, args...));
|
std::bind(&FunctionWrapperWithBarrier<Function, Args...>::run, b,
|
||||||
|
std::move(f), args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Function, class... Args>
|
template <class Function, class... Args>
|
||||||
EIGEN_STRONG_INLINE void enqueueNoNotification(Function&& f, Args&&... args) const {
|
EIGEN_STRONG_INLINE void enqueueNoNotification(Function&& f,
|
||||||
|
Args&&... args) const {
|
||||||
if (sizeof...(args) > 0) {
|
if (sizeof...(args) > 0) {
|
||||||
pool_->Schedule(std::bind(f, args...));
|
pool_->Schedule(std::bind(std::move(f), args...));
|
||||||
} else {
|
} else {
|
||||||
pool_->Schedule(f);
|
pool_->Schedule(std::move(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user