2017-09-13 03:35:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
#include <functional>
|
|
|
|
#include <mutex>
|
|
|
|
#include <thread>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// Helper methods for starting threads that do some work. Enables test code to
|
|
|
|
// wait for all work to complete.
|
|
|
|
struct WorkThread {
|
|
|
|
// Launch a new thread. |entry_point| will be called continously. It should
|
|
|
|
// return true if it there is still known work to be done.
|
2017-09-22 01:14:57 +00:00
|
|
|
static void StartThread(const std::string& thread_name,
|
2017-12-28 17:18:54 +00:00
|
|
|
std::function<void()> entry_point);
|
2017-09-13 03:35:27 +00:00
|
|
|
|
|
|
|
// Static-only class.
|
|
|
|
WorkThread() = delete;
|
|
|
|
};
|