# NativeRingQueue<T>

> A fixed-size circular buffer. For single-threaded uses only.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **Implements:** [INativeDisposable](/engine/6000.7/script-reference/unity/collections/inativedisposable.md), [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public struct NativeRingQueue<T> : INativeDisposable, IDisposable where T : unmanaged
```

## Remarks

This container can't be used in parallel jobs, just on single-thread (for example: main thread, or single IJob).

## Static Fields

| Value                                                                                            | Description                                                     |
| ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
| [MaxCapacity](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/maxcapacity.md) | The maximum number of elements this type of container can hold. |

## Constructors

| Constructor                                                                                                                                                                                            | Description                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
| [NativeRingQueue\`1(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle,Unity.Collections.NativeArrayOptions)](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/ctor.md) | Initializes and returns an instance of NativeRingQueue. |

## Properties

| Property                                                                                     | Description                                                      |
| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [Capacity](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/capacity.md)   | The number of elements that fit in the internal buffer.          |
| [IsCreated](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/iscreated.md) | Whether this queue has been allocated (and not yet deallocated). |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/isempty.md)     | Whether the queue is empty.                                      |
| [Length](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/length.md)       | The number of elements currently in this queue.                  |

## Methods

| Method                                                                                         | Description                                         |
| ---------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| [Dequeue](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/dequeue.md)       | Removes the element from the end of the queue.      |
| [Dispose](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/dispose.md)       | Releases all resources (memory and safety handles). |
| [Enqueue](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/enqueue.md)       | Adds an element at the front of the queue.          |
| [TryDequeue](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/trydequeue.md) | Removes the element from the end of the queue.      |
| [TryEnqueue](/engine/6000.7/script-reference/unity/collections/nativeringqueue1/tryenqueue.md) | Adds an element at the front of the queue.          |
