Reworked the threadpool cancellation mechanism to not depend on pthread_cancel since it turns out that pthread_cancel doesn't work properly on numerous platforms.

This commit is contained in:
Benoit Steiner
2016-12-09 13:05:14 -08:00
parent 3d59a47720
commit 2f5b7a199b
5 changed files with 48 additions and 26 deletions

View File

@@ -23,7 +23,8 @@ struct StlThreadEnvironment {
public:
EnvThread(std::function<void()> f) : thr_(std::move(f)) {}
~EnvThread() { thr_.join(); }
void Cancel() { EIGEN_THREAD_CANCEL(thr_); }
// This function is called when the threadpool is cancelled.
void OnCancel() { }
private:
std::thread thr_;