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

@@ -19,7 +19,8 @@ class ThreadPoolInterface {
// Submits a closure to be run by a thread in the pool.
virtual void Schedule(std::function<void()> fn) = 0;
// Cancel all the threads in the pool.
// Stop processing the closures that have been enqueued.
// Currently running closures may still be processed.
virtual void Cancel() = 0;
// Returns the number of threads in the pool.