| 341 | |
| 342 | template<typename TDatums, typename TWorker, typename TQueue> |
| 343 | bool ThreadManager<TDatums, TWorker, TQueue>::waitAndPop(TDatums& tDatums) |
| 344 | { |
| 345 | try |
| 346 | { |
| 347 | if (mThreadManagerMode != ThreadManagerMode::Asynchronous |
| 348 | && mThreadManagerMode != ThreadManagerMode::AsynchronousOut) |
| 349 | error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); |
| 350 | if (mTQueues.empty()) |
| 351 | error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); |
| 352 | return (*mTQueues.rbegin())->waitAndPop(tDatums); |
| 353 | } |
| 354 | catch (const std::exception& e) |
| 355 | { |
| 356 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 357 | return false; |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | template<typename TDatums, typename TWorker, typename TQueue> |
| 362 | void ThreadManager<TDatums, TWorker, TQueue>::add(const std::vector<std::tuple<unsigned long long, std::vector<TWorker>, |