| 65 | |
| 66 | template<typename T> |
| 67 | void ObjectQueue<T>::write(T * obj) { |
| 68 | /* mutex lock */ |
| 69 | std::unique_lock<std::mutex> lock(m_mutex); |
| 70 | |
| 71 | /* wait for free space */ |
| 72 | tellgChanged.wait(lock, [&] { |
| 73 | return |
| 74 | m_abort || |
| 75 | static_cast<uint32_t>(m_queue.size()) < m_bufferSize; |
| 76 | }); |
| 77 | |
| 78 | /* push data */ |
| 79 | m_queue.push(obj); |
| 80 | |
| 81 | /* increase put count */ |
| 82 | m_tellp++; |
| 83 | |
| 84 | /* shift eof */ |
| 85 | if (m_tellp > m_fileSize) |
| 86 | m_fileSize = m_tellp; |
| 87 | |
| 88 | /* notify */ |
| 89 | tellpChanged.notify_all(); |
| 90 | } |
| 91 | |
| 92 | template<typename T> |
| 93 | uint32_t ObjectQueue<T>::tellp() const { |