| 179 | |
| 180 | template<typename TDatums, typename TWorker, typename TQueue> |
| 181 | void ThreadManager<TDatums, TWorker, TQueue>::exec() |
| 182 | { |
| 183 | try |
| 184 | { |
| 185 | opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); |
| 186 | // Set threads |
| 187 | multisetToThreads(); |
| 188 | if (!mThreads.empty()) |
| 189 | { |
| 190 | opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); |
| 191 | // Start threads |
| 192 | for (auto i = 0u; i < mThreads.size() - 1; i++) |
| 193 | mThreads.at(i)->startInThread(); |
| 194 | (*mThreads.rbegin())->exec(spIsRunning); |
| 195 | // Stop threads - It will arrive here when the exec() command has finished |
| 196 | stop(); |
| 197 | } |
| 198 | opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); |
| 199 | } |
| 200 | catch (const std::exception& e) |
| 201 | { |
| 202 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | template<typename TDatums, typename TWorker, typename TQueue> |
| 207 | void ThreadManager<TDatums, TWorker, TQueue>::start() |