Exemple #1
0
        /// <summary>
        /// Returns parallel writer instance.
        /// </summary>
        /// <returns>Parallel writer instance.</returns>
        public ParallelWriter AsParallelWriter()
        {
            ParallelWriter writer;

            writer.m_Writer = m_MultiHashMapData.AsParallelWriter();
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            writer.m_Safety = m_Safety;
#endif
            return(writer);
        }
    public void UnsafeMultiHashMap_AddJob()
    {
        var container = new UnsafeMultiHashMap <int, int>(32, Allocator.TempJob);

        var job = new UnsafeMultiHashMapAddJob()
        {
            Writer = container.AsParallelWriter(),
        };

        job.Schedule(3, 1).Complete();

        Assert.True(container.ContainsKey(123));
        Assert.AreEqual(container.CountValuesForKey(123), 3);

        container.Dispose();
    }