Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UnsafeRingQueue<T>

A fixed-size circular buffer.
Read time 1 minuteLast updated 12 days ago

Definition

public struct UnsafeRingQueue<T> : INativeDisposable, IDisposable where T : unmanaged

Fields

Value

Description

AllocatorThe allocator used to create the internal buffer.
PtrThe internal buffer where the content is stored.

Static Fields

Value

Description

MaxCapacityThe maximum number of elements this type of container can hold.

Constructors

Constructor

Description

UnsafeRingQueue`1(`0*,System.Int32)Initializes and returns an instance of UnsafeRingQueue which aliasing an existing buffer.
UnsafeRingQueue`1(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle,Unity.Collections.NativeArrayOptions)Initializes and returns an instance of UnsafeRingQueue.

Properties

Property

Description

CapacityThe number of elements that fit in the internal buffer.
IsCreatedWhether this queue has been allocated (and not yet deallocated).
IsEmptyWhether the queue is empty.
LengthThe number of elements currently in this queue.

Methods

Method

Description

DequeueRemoves the element from the end of the queue.
DisposeReleases all resources (memory and safety handles).
EnqueueAdds an element at the front of the queue.
TryDequeueRemoves the element from the end of the queue.
TryEnqueueAdds an element at the front of the queue.