| 46 | using ChunkData = std::vector<std::vector<std::string>>; |
| 47 | |
| 48 | class ThreadJoiner { |
| 49 | public: |
| 50 | explicit ThreadJoiner(std::shared_ptr<std::thread> thread) |
| 51 | : thread_(std::move(thread)) {} |
| 52 | |
| 53 | ~ThreadJoiner() { |
| 54 | if (thread_->joinable()) { |
| 55 | thread_->join(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | protected: |
| 60 | std::shared_ptr<std::thread> thread_; |
| 61 | }; |
| 62 | |
| 63 | template <typename Func> |
| 64 | ThreadJoiner RunThread(Func&& func) { |