r/cpp • u/Beginning-Safe4282 • May 22 '26
Building a Fast Lock-Free Queue in Modern C++ From Scratch
https://jaysmito.dev/blog/blog/04-fast-lockfree-queues/
135
Upvotes
r/cpp • u/Beginning-Safe4282 • May 22 '26
View all comments
72
u/woppo May 23 '26
You have a member function called IsEmpty:
// This is an extremely handy function which we can add to the // Queue API so that we can use it to check if a queue is filled // or not and this will be very useful for a lot of situations // where you could technically put a thread to sleep based on // this value. bool IsEmpty(uint32_t threadId) { (void)threadId; std::unique_lock lock(m_Mutex); return m_Queue.empty(); }It is not extremley handy. It should be called WasEmpty. It has no use whatsoever.