| 206 | |
| 207 | template<typename TDatums, typename TQueue> |
| 208 | bool QueueBase<TDatums, TQueue>::waitAndPush(const TDatums& tDatums) |
| 209 | { |
| 210 | try |
| 211 | { |
| 212 | std::unique_lock<std::mutex> lock{mMutex}; |
| 213 | mConditionVariable.wait(lock, [this]{return mTQueue.size() < getMaxSize() || mPushIsStopped; }); |
| 214 | return push(tDatums); |
| 215 | } |
| 216 | catch (const std::exception& e) |
| 217 | { |
| 218 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 219 | return false; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | template<typename TDatums, typename TQueue> |
| 224 | bool QueueBase<TDatums, TQueue>::tryPop(TDatums& tDatums) |