libluna: Add CircularQueue::is_empty()
This commit is contained in:
parent
b17793134e
commit
6c26236167
@ -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)
|
bool try_push(const T& value)
|
||||||
{
|
{
|
||||||
usize current_tail = m_tail.load(MemoryOrder::Relaxed);
|
usize current_tail = m_tail.load(MemoryOrder::Relaxed);
|
||||||
@ -71,6 +76,11 @@ template <typename T> class DynamicCircularQueue
|
|||||||
if (m_data) free_impl(m_data);
|
if (m_data) free_impl(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_empty()
|
||||||
|
{
|
||||||
|
return m_tail.load() == m_head.load();
|
||||||
|
}
|
||||||
|
|
||||||
Result<void> set_size(usize size)
|
Result<void> set_size(usize size)
|
||||||
{
|
{
|
||||||
m_data = (T*)TRY(calloc_impl(size + 1, sizeof(T), false));
|
m_data = (T*)TRY(calloc_impl(size + 1, sizeof(T), false));
|
||||||
|
Loading…
Reference in New Issue
Block a user