MCPcopy Create free account
hub / github.com/KDE/labplot / read

Method read

src/3rdparty/vector_blf/src/Vector/BLF/ObjectQueue.cpp:25–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24template<typename T>
25T * ObjectQueue<T>::read() {
26 /* mutex lock */
27 std::unique_lock<std::mutex> lock(m_mutex);
28
29 /* wait for data */
30 tellpChanged.wait(lock, [&] {
31 return
32 m_abort ||
33 !m_queue.empty() ||
34 (m_tellg >= m_fileSize);
35 });
36
37 /* get first entry */
38 T * ohb = nullptr;
39 if (m_queue.empty())
40 m_rdstate = std::ios_base::eofbit | std::ios_base::failbit;
41 else {
42 ohb = m_queue.front();
43 m_queue.pop();
44
45 /* set state */
46 m_rdstate = std::ios_base::goodbit;
47
48 /* increase get count */
49 m_tellg++;
50 }
51
52 /* notify */
53 tellgChanged.notify_all();
54
55 return ohb;
56}
57
58template<typename T>
59uint32_t ObjectQueue<T>::tellg() const {

Callers

nothing calls this directly

Calls 3

waitMethod · 0.80
popMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected