Struct cc_queue::CcQueue
[−]
[src]
pub struct CcQueue<T, A: Allocator>(_);
This is the cc queue object.
It is safe to send references between threads.
Each thread accessing the queue should call new_per_thread_handle
.
The queue supports being dropped and all Nodes being freed, however...
It does not have any way to free the data owned by the nodes, so a memory leak is quite likely.
Instead, it is better to call clear()
with a callback which can free node data, which requires that there are no PerQueueThreadHandle
in existence, even for the current thread.
Rust's borrow checker should be able to enforce this.
Methods
impl<T, A: Allocator> CcQueue<T, A>
[src]
pub fn new(allocator: A) -> Self
[src]
Create a new queue. Specify an allocator implementation which provides memory for the queue and its nodes. This can be the heap, or it can be a persistent memory or mmap'd file.
pub fn new_per_thread_handle<'queue>(
&'queue self
) -> PerQueueThreadHandle<'queue, T, A>
[src]
&'queue self
) -> PerQueueThreadHandle<'queue, T, A>
Create a new per-thread handle.
pub fn clear<FreeData: Fn(NonNull<T>)>(&mut self, free_data: FreeData)
[src]
Clear the queue. Only works on a queue that is acquiescent.
Trait Implementations
impl<T: Debug, A: Debug + Allocator> Debug for CcQueue<T, A>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T, A: Allocator> Send for CcQueue<T, A>
[src]
impl<T, A: Allocator> Sync for CcQueue<T, A>
[src]
impl<T, A: Allocator> AllocatorOpened<A> for CcQueue<T, A>
[src]
fn allocator_opened(&mut self, allocator: A)
[src]
Allocator was opened. Reset any temporary state, or adjust pointer offsets. Read more