SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Pop()

template<typename T >
T scl::thread_queue< T >::Pop ( )
inline

Pop a item from this queue.

Returns
Returns item.

Definition at line 88 of file ThreadQueue.h.

89 {
90 std::unique_lock<std::mutex> lock(m_Mutex);
91
92 if (IsEmpty())
93 m_NotEmpty.wait(lock, [&](){ return !IsEmpty(); });
94
95 auto ptr = m_Queue.front();
96 m_Queue.pop();
97 --m_Count;
98
99 return std::move(ptr);
100 }
std::mutex m_Mutex
Mutex of this queue.
Definition ThreadQueue.h:58
std::atomic_int m_Count
Count of tasks.
Definition ThreadQueue.h:68
std::condition_variable m_NotEmpty
Not empty condition.
Definition ThreadQueue.h:63
bool IsEmpty() const
Is this queue is empty. @reutrn Returns true if empty.
Definition ThreadQueue.h:46
std::queue< T > m_Queue
This wrapped queue.
Definition ThreadQueue.h:73