ccls/src/work_thread.h

19 lines
552 B
C
Raw Normal View History

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,
std::function<void()> entry_point);
2017-09-13 03:35:27 +00:00
// Static-only class.
WorkThread() = delete;
};