Added support for thread cancellation on Linux

This commit is contained in:
Benoit Steiner
2016-12-08 08:12:49 -08:00
parent 6811e6cf49
commit 7bfff85355
6 changed files with 58 additions and 0 deletions

View File

@@ -97,6 +97,12 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
env_.ExecuteTask(t); // Push failed, execute directly.
}
void Cancel() {
for (size_t i = 0; i < threads_.size(); i++) {
threads_[i]->Cancel();
}
}
int NumThreads() const final {
return static_cast<int>(threads_.size());
}