Ejemplo n.º 1
0
        public void CanDeallocateOnJobCompletion()
        {
            NativeLongPtr intPtr = new NativeLongPtr(Allocator.TempJob);
            var           job    = new DeallocateOnJobCompletionJob {
                LongPtr = intPtr
            };

            job.Run();

            Assert.That(
                () => intPtr.Value = 10,
                Throws.TypeOf <InvalidOperationException>());
        }
        public void CanDeallocateOnJobCompletion()
        {
            TestDisposable disposable = TestDisposable.Create();
            var            shared     = disposable.Counter.Share(Allocator.TempJob);
            var            job        = new DeallocateOnJobCompletionJob {
                Shared = shared
            };

            job.Run();
            Assert.That(
                () => disposable.Counter.Num[0],
                Throws.TypeOf <InvalidOperationException>());
        }