libluna: Add CircularQueue::is_empty()

This commit is contained in:
apio 2023-08-02 11:55:08 +02:00
parent b17793134e
commit 6c26236167
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -16,6 +16,11 @@ template <typename T, usize Size> class CircularQueue
{
}
bool is_empty()
{
return m_tail.load() == m_head.load();
}
bool try_push(const T& value)
{
usize current_tail = m_tail.load(MemoryOrder::Relaxed);
@ -71,6 +76,11 @@ template <typename T> class DynamicCircularQueue
if (m_data) free_impl(m_data);
}
bool is_empty()
{
return m_tail.load() == m_head.load();
}
Result<void> set_size(usize size)
{
m_data = (T*)TRY(calloc_impl(size + 1, sizeof(T), false));