Made ThreadPoolInterface::Cancel() an optional functionality

This commit is contained in:
Benoit Steiner 2016-12-12 11:58:38 -08:00
parent 57acb05eef
commit 8ae68924ed

View File

@ -19,9 +19,10 @@ class ThreadPoolInterface {
// Submits a closure to be run by a thread in the pool.
virtual void Schedule(std::function<void()> fn) = 0;
// Stop processing the closures that have been enqueued.
// If implemented, stop processing the closures that have been enqueued.
// Currently running closures may still be processed.
virtual void Cancel() = 0;
// If not implemented, does nothing.
virtual void Cancel() {}
// Returns the number of threads in the pool.
virtual int NumThreads() const = 0;