/// <summary> /// Constructs a new queue with type of memory allocation. /// </summary> /// <param name="allocator">A member of the /// [Unity.Collections.Allocator](https://docs.unity3d.com/ScriptReference/Unity.Collections.Allocator.html) enumeration.</param> public NativeQueue(Allocator allocator) { CollectionHelper.CheckIsUnmanaged <T>(); m_QueuePool = NativeQueueBlockPool.QueueBlockPool; m_AllocatorLabel = allocator; NativeQueueData.AllocateQueue <T>(allocator, out m_Buffer); #if ENABLE_UNITY_COLLECTIONS_CHECKS DisposeSentinel.Create(out m_Safety, out m_DisposeSentinel, 0, allocator); #endif }
public unsafe NativeQueue(Allocator label) { m_QueuePool = NativeQueueBlockPool.QueueBlockPool; #if ENABLE_UNITY_COLLECTIONS_CHECKS if (!UnsafeUtility.IsBlittable <T>()) { throw new ArgumentException(string.Format("{0} used in NativeQueue<{0}> must be blittable", typeof(T))); } #endif m_AllocatorLabel = label; NativeQueueData.AllocateQueue <T>(label, out m_Buffer); #if ENABLE_UNITY_COLLECTIONS_CHECKS DisposeSentinel.Create(out m_Safety, out m_DisposeSentinel, 0); #endif }