This method should be called under the mutex
| 207 | // This method should be called under the mutex |
| 208 | // |
| 209 | bool Queue::tryToPut(const Variant& vData) |
| 210 | { |
| 211 | bool fNoOverflow = true; |
| 212 | ++m_nPutTryCount; |
| 213 | auto nSize = m_data.size(); |
| 214 | if (nSize >= m_nMaxSize) |
| 215 | { |
| 216 | if (!m_fCircular) return false; |
| 217 | |
| 218 | // Process circular mode - remove the most old event |
| 219 | fNoOverflow = false; |
| 220 | m_data.pop_front(); |
| 221 | ++m_nDropCount; |
| 222 | } |
| 223 | |
| 224 | m_data.push_back(vData); |
| 225 | ++m_nPutCount; |
| 226 | return fNoOverflow; |
| 227 | } |
| 228 | |
| 229 | // |
| 230 | // |