| 322 | |
| 323 | template<typename TDatums, typename TWorker, typename TQueue> |
| 324 | bool ThreadManager<TDatums, TWorker, TQueue>::tryPop(TDatums& tDatums) |
| 325 | { |
| 326 | try |
| 327 | { |
| 328 | if (mThreadManagerMode != ThreadManagerMode::Asynchronous |
| 329 | && mThreadManagerMode != ThreadManagerMode::AsynchronousOut) |
| 330 | error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); |
| 331 | if (mTQueues.empty()) |
| 332 | error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); |
| 333 | return (*mTQueues.rbegin())->tryPop(tDatums); |
| 334 | } |
| 335 | catch (const std::exception& e) |
| 336 | { |
| 337 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 338 | return false; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | template<typename TDatums, typename TWorker, typename TQueue> |
| 343 | bool ThreadManager<TDatums, TWorker, TQueue>::waitAndPop(TDatums& tDatums) |