|
|
@@ -10,8 +10,9 @@
|
|
|
namespace bx
|
|
|
{
|
|
|
// http://drdobbs.com/article/print?articleId=210604448&siteSectionName=
|
|
|
- inline SpScUnboundedQueue::SpScUnboundedQueue()
|
|
|
- : m_first(new Node(NULL) )
|
|
|
+ inline SpScUnboundedQueue::SpScUnboundedQueue(AllocatorI* _allocator)
|
|
|
+ : m_allocator(_allocator)
|
|
|
+ , m_first(BX_NEW(m_allocator, Node)(NULL) )
|
|
|
, m_divider(m_first)
|
|
|
, m_last(m_first)
|
|
|
{
|
|
|
@@ -23,19 +24,19 @@ namespace bx
|
|
|
{
|
|
|
Node* node = m_first;
|
|
|
m_first = node->m_next;
|
|
|
- delete node;
|
|
|
+ BX_DELETE(m_allocator, node);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
inline void SpScUnboundedQueue::push(void* _ptr)
|
|
|
{
|
|
|
- m_last->m_next = new Node(_ptr);
|
|
|
+ m_last->m_next = BX_NEW(m_allocator, Node)(_ptr);
|
|
|
atomicExchangePtr( (void**)&m_last, m_last->m_next);
|
|
|
while (m_first != m_divider)
|
|
|
{
|
|
|
Node* node = m_first;
|
|
|
m_first = m_first->m_next;
|
|
|
- delete node;
|
|
|
+ BX_DELETE(m_allocator, node);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -68,7 +69,8 @@ namespace bx
|
|
|
}
|
|
|
|
|
|
template<typename Ty>
|
|
|
- inline SpScUnboundedQueueT<Ty>::SpScUnboundedQueueT()
|
|
|
+ inline SpScUnboundedQueueT<Ty>::SpScUnboundedQueueT(AllocatorI* _allocator)
|
|
|
+ : m_queue(_allocator)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
@@ -96,7 +98,8 @@ namespace bx
|
|
|
}
|
|
|
|
|
|
#if BX_CONFIG_SUPPORTS_THREADING
|
|
|
- inline SpScBlockingUnboundedQueue::SpScBlockingUnboundedQueue()
|
|
|
+ inline SpScBlockingUnboundedQueue::SpScBlockingUnboundedQueue(AllocatorI* _allocator)
|
|
|
+ : m_queue(_allocator)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
@@ -126,7 +129,8 @@ namespace bx
|
|
|
}
|
|
|
|
|
|
template<typename Ty>
|
|
|
- inline SpScBlockingUnboundedQueueT<Ty>::SpScBlockingUnboundedQueueT()
|
|
|
+ inline SpScBlockingUnboundedQueueT<Ty>::SpScBlockingUnboundedQueueT(AllocatorI* _allocator)
|
|
|
+ : m_queue(_allocator)
|
|
|
{
|
|
|
}
|
|
|
|