Esempio n. 1
0
        public void SchedulingGenericJobUnsafelyThrows()
        {
            var j0     = new MyGenericResizeJob <int>();
            var length = 5;

            j0.m_ListLength  = length;
            j0.m_GenericList = new NativeList <int>(1, Allocator.TempJob);
            var handle0 = j0.Schedule();
            var j1      = new MyGenericJobDefer <int>();

            j1.m_Value       = 6;
            j1.m_GenericList = j0.m_GenericList;
            Assert.Throws <InvalidOperationException>(() => j1.Schedule(j0.m_GenericList, 1).Complete());
            handle0.Complete();
            j0.m_GenericList.Dispose();
        }
Esempio n. 2
0
        public void GenericScheduleJobPair <T>(T value) where T : struct
        {
            var j0     = new MyGenericResizeJob <T>();
            var length = 5;

            j0.m_ListLength  = length;
            j0.m_GenericList = new NativeList <T>(1, Allocator.TempJob);
            var handle0 = j0.Schedule();

            var j1 = new MyGenericJobDefer <T>();

            j1.m_Value       = value;
            j1.m_GenericList = j0.m_GenericList;
            j1.Schedule(j0.m_GenericList, 1, handle0).Complete();

            Assert.AreEqual(length, j1.m_GenericList.Length);
            for (int i = 0; i != j1.m_GenericList.Length; i++)
            {
                Assert.AreEqual(value, j1.m_GenericList[i]);
            }
            j0.m_GenericList.Dispose();
        }