| 189 | |
| 190 | template<typename TDatums, typename TQueue> |
| 191 | bool QueueBase<TDatums, TQueue>::tryPush(const TDatums& tDatums) |
| 192 | { |
| 193 | try |
| 194 | { |
| 195 | const std::lock_guard<std::mutex> lock{mMutex}; |
| 196 | if (mTQueue.size() >= getMaxSize()) |
| 197 | return false; |
| 198 | return push(tDatums); |
| 199 | } |
| 200 | catch (const std::exception& e) |
| 201 | { |
| 202 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 203 | return false; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | template<typename TDatums, typename TQueue> |
| 208 | bool QueueBase<TDatums, TQueue>::waitAndPush(const TDatums& tDatums) |