#include "thread/executor.h" #include #include namespace threading { void SameThreadExecutor::Run(std::function func) { func(); } void NewThreadExecutor::Run(std::function func) { threads_.push_back(std::thread(func)); } NewThreadExecutor::~NewThreadExecutor() { // If Run was ever called... for (auto &thread : threads_) thread.join(); threads_.clear(); } } // namespace threading